1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Auto-updating of table cells?

Discussion in 'HTML, Graphics & Programming' started by Chads, 28 Jan 2006.

  1. Chads

    Mobster

    Joined: 8 Sep 2003

    Posts: 2,882

    Location: Location Location!

    Hey there,

    I'm in Dreamweaver. Several of my pages contain a table cell that has my latest "news" in it. At the moment I am having to type in the news on one page, then copy+paste it over to the other pages. Is there a - preferably simple - way I can make the content of the cells on all pages children to a single parent? That way I could just update one page, and have the others automatically update.

    Cheers, don't worry if it's a ridiculous hassle,
     
  2. Jake 2.0

    Banned

    Joined: 16 Dec 2002

    Posts: 10,237

    you could just write a new page called news.htm and update that, and wherever you need to have them news just put in includes('news.htm') and then you just need to update that one file
     
  3. Chads

    Mobster

    Joined: 8 Sep 2003

    Posts: 2,882

    Location: Location Location!

    That sounds perfect, but could you explain where abouts I put that command? I haven't used Dreamweaver for long and HTMl is mostly russian to me.

    Edit: Hmm, looks like you mean server-side include? I'll take a look...
     
  4. Beansprout

    Man of Honour

    Joined: 31 Jan 2004

    Posts: 16,312

    Location: Plymouth

    If you're going to answer, please don't spurt out drivel. You gave the right answer (ish) but didn't explain so now somebody else has to clean up.

    It's late, I'm tired, and I finally decided to tell you that. So forgive me :p

    OP - what Freak_Boy means is use something like SSI (server-side includes) or PHP to include a single file into other files :)

    So what you can do is use PHP, for example, by creating a file called in which lies all the news items (and saveit the same directory as the other website files) and then, in the pages where you want to show the news items, you add this code into the place of the news section:

    Code:
    <?php include 'news.htm'; ?>
    
    The file will also need a .php extension for the PHP code (the section between the <php and ?> tags) to be parsed by the server.

    You could use SSI but PHP can also do many other things which may be a better option as it's more flexible should you want to do other things :)

    The only downside to either method is that you have to change the file extensions for all pages using the language - so for SSI you normally need the .shtml extension, whereas for PHP you normally need .php. But that should be a one-time only thing and there might be some batch file renaming tools around :)

    So in short...easily possible, bit of a pain to setup at first if you have lots of files. And remember to add the code in Dreamweaver's code view or (I think) it'll save it as actual plain text instead :)
     
  5. Chads

    Mobster

    Joined: 8 Sep 2003

    Posts: 2,882

    Location: Location Location!

    Nice one, cheers.
     
  6. Jake 2.0

    Banned

    Joined: 16 Dec 2002

    Posts: 10,237

    OR just wait for me to explain it properly :rolleyes:
     
  7. Beansprout

    Man of Honour

    Joined: 31 Jan 2004

    Posts: 16,312

    Location: Plymouth

    I'd grab you on MSN if I really wanted to dig into you, don't worry. I was just frustrated with the half-answer you gave considering you've asked for help often and received quite a bit and don't say thankyou.

    Anyway - let's not drag this OT even more (those Donnies will notice) - e-mail me if you have a case to argue, otherwise reply to those threads with a thankyou. Or rob will actually cry :p
     
  8. Jake 2.0

    Banned

    Joined: 16 Dec 2002

    Posts: 10,237

    oh right so now i know why you almost always criticise my posts! as i have been wondering why you give me harsh replies! as for the reasons, catch u on msn if i am ever on!

    PS> if i really didnt want to help, i wouldnt even have replied in the first instance,or even bother looking at this section whenever i come on ocuk, most of the times there are loads more people who are "better" then me so i dont really get a chance to reply!

    oh and atleast i dont come on ocuk only when i need help (not a dig at you but some people)
     
    Last edited by a moderator: 29 Jan 2006
  9. Beansprout

    Man of Honour

    Joined: 31 Jan 2004

    Posts: 16,312

    Location: Plymouth

    Well if you'd bothered to reply to those three threads with a thankyou I wouldn't have bothered with all this. I cba with pettyness but what I can be arsed with is manners young boy, manners :D

    Aye, that's a good point. Those people suck :(
     
  10. Jake 2.0

    Banned

    Joined: 16 Dec 2002

    Posts: 10,237

    ok i officially declare that in every thread i havent said THANK YOU! thank you, just because i dont write it doesnt mean i dont appreciate it! oh and thankyou in advance to EVERY problem you will all solve of mine in future ;)

    i am glad we have sorted out this :)

    PS> in future instead of taking it out indirectly, you should just deal with the matter directly ;)

    PS> sorry for derailing the thread :o
     
  11. roboffer

    Sgarrista

    Joined: 18 Oct 2002

    Posts: 9,599

    Location: Sunderland

    Just a little word of note to the thread starter, have a look into templates in Dreamweaver :)