Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2013
    Location
    Florida
    Posts
    75
    Thanks
    2
    Thanked 0 Times in 0 Posts

    How to Physically change html doc text from outside

    I have an html5 doc (webpage) that has a series of list items, each li has an image and descriptive text. lets say i have 20 of them. if i need to replace one, it is awkward to go searching for it, and then change the text relating to the new image and new description (and prone to mis-typing).

    what i would like to be able to do is edit the text from another program, or by inserting some temporary javascript or jQuery into the doc.

    i have successfully changed it using innerHTML, but that is a temporary change. when i re-open the document, there is the old information.

    any suggestions ? (i hope i won't involve learning mySequel).

  • #2
    Banned
    Join Date
    Mar 2013
    Posts
    139
    Thanks
    0
    Thanked 9 Times in 9 Posts
    I wouldn't do this with javascript because your page will fall over in browsers that don't support or have javascript turned off.

    A much better way is to do this server side. Whether you use PHP or some other language, the concept is exactly the same.

    Generally you would use a CMS (Content Management System), which uses a database to store the website content and other stuff. It would be fairly straight forward to create your own CMS, in PHP, for editing your lists. But since you're not keen on learning MySQL, plan B could be to have a 2D array at the top of your web page to store all your lists' content and then use PHP to create the html for the lists by looping through the 2D array. So effectively, the 2D array basically replaces the database.

    So whenever you want to change the content of the lists, you simply just edit the 2D array's content at the top of the web page.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •