SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Location
    Australia
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Making a 'notice' box appear on multiple pages

    Hi,

    I have a small webpage that I use in a highschool IT class.
    (sorry my post count is too low to actually post a link, I have attached a picture).

    I created a little 'ITS Notices' box on the page which displays on multiple pages. To achieve this I copy the code and paste it on all the pages. I.E. If I update the box, I have to copy-paste to all the pages. I initially left it this way partly as a teaching tool and partly because I didn't know how to fix it.

    Do I need php or Javascript to achieve this effect without the tedious copy-pasting?

    Thanks,
    Cassie.


    please note:
    The webpage itself also serves as a learning experiment for the students. Some flaws are intentional, for example it will not display properly in IE. This serves an initial purpose of reminding students to use Firefox. An important lesson when the majority of beginners at that level think the IE is the Internet...not just a browser. Having said that, some flaws are just purely my own lack of skill.
    Attached Images Attached Images

  2. #2
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, you can use an include statement.

    Where you want to include the text, use this.
    PHP Code:
    <?php include('file.php'); ?>
    Then simply create another file called 'file.php', change the name, extention and location to where you need. In that file put what you want to be included. e.g.

    HTML Code:
    <div id="notice">
     Notice! Sitepoint forums are awesome! 
    </div>
    If you want to remove the text, just empty 'file.php' or remove <?php include('file.php') ; ?> from the pages


Bookmarks

Posting Permissions

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