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 14 of 14
  1. #1
    Regular Coder cineweekly.com's Avatar
    Join Date
    Aug 2010
    Posts
    485
    Thanks
    14
    Thanked 3 Times in 3 Posts

    How can I have updates on every page without using iframe?

    I'm currently using iframes to insert a section with updates to my latest articles. What other options do I have? I would also like to use a similar technique on my menu and logo so I can change them in the future and have all my pages synch up with the new design. Right now I put the code for the menu on every page.

  • #2
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,333
    Thanks
    5
    Thanked 363 Times in 360 Posts
    use a server side scripting language like COldfusion or PHP. The you create seperate files for sidebars, headers, footers and such and "include" them. That way you can design a single file like a menu and when you need to change it, it changes on all your pages. Also there is a way to create library items in html, but its been years since I did that and cant remember how,,...lol I use CF now.

  • #3
    Regular Coder
    Join Date
    Aug 2005
    Location
    MS
    Posts
    821
    Thanks
    10
    Thanked 78 Times in 76 Posts
    Server Side Includes are the way to go for making changes from time to time for multiple pages. That's provided your server allows its use. I use it all the time on every page I have.
    ☠ ☠RON☠ ☠

  • #4
    Regular Coder cineweekly.com's Avatar
    Join Date
    Aug 2010
    Posts
    485
    Thanks
    14
    Thanked 3 Times in 3 Posts
    Thanks guys. I'll look into it. Is what I'm trying to do difficult for a beginner in php? I started off with html and now I've implemented a lot of CSS and recently set up a phpbb forum so I'm getting cluttered with new coding. I still have a little actionscript somewhere in the back of my head too so I can't take much more.

  • #5
    Regular Coder Lerura's Avatar
    Join Date
    Aug 2005
    Location
    Denmark
    Posts
    878
    Thanks
    0
    Thanked 114 Times in 113 Posts
    you can also create a .js vith a variable that contains the message, include that .js into the documents, and then use a script to render the text into the document.

  • #6
    Regular Coder
    Join Date
    Jan 2010
    Posts
    153
    Thanks
    53
    Thanked 0 Times in 0 Posts
    Here's a php code as an example:
    PHP Code:
    <?php include ('header.php'); ?>

    Content, blah blah

    <?php include ('updates.php'); ?>

    <?php include ('footer.php'); ?>

    In header.php, you might have the logo and menu, while in the footer.php you can put your bottom layout and in the updates.php you can put the updates in there.
    Last edited by wincode; 09-02-2010 at 05:42 AM.

  • #7
    Regular Coder cineweekly.com's Avatar
    Join Date
    Aug 2010
    Posts
    485
    Thanks
    14
    Thanked 3 Times in 3 Posts
    So I use it just like an iframe but with .php at the end and proper tags? Sorry if it sounds dumb but I've never even looked at sample php script before.

  • #8
    Regular Coder
    Join Date
    Aug 2005
    Location
    MS
    Posts
    821
    Thanks
    10
    Thanked 78 Times in 76 Posts
    You DON'T have to use PHP includes. Just set up the .htaccess file to use them and rename your files "*.shtml". You don't even have to do that if you rewrite the .htaccess file to deliver up an "*.html" with the included code.

    Using Includes in a webpage generator

    I use that instead of PHP on my pages as I started out using it and now have several hundred pages.
    ☠ ☠RON☠ ☠

  • #9
    Regular Coder cineweekly.com's Avatar
    Join Date
    Aug 2010
    Posts
    485
    Thanks
    14
    Thanked 3 Times in 3 Posts
    Here's my menu in a php file:
    cineweekly.com/menu.php

    How do I get this to appear on my pages?
    Last edited by cineweekly.com; 09-08-2010 at 08:11 PM.

  • #10
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,333
    Thanks
    5
    Thanked 363 Times in 360 Posts
    Quote Originally Posted by cineweekly.com View Post
    Here's my menu in a php file:
    cineweekly.com/menu.php

    How do I get this to appear on my pages?
    Where ever you want this menu.php to be, I would suggest creating a div, say <div id=menu>
    <?php require ("menu.php"); ?>

    </div>

    Just like that. Then you can style the menu div how you like

    Remember though, you have the url with menu.php as a pathway to the menu.php file. If you are just wanting to include this menu as apart of each page, much like a header or footer, then menu would be in a separate file with no html page tags and no doc type specified. Just the menu elements such as <ul> and <li>, then the include would "paste" the contents of the menu page in every page you place the php include on

  • Users who have thanked teedoff for this post:

    cineweekly.com (09-08-2010)

  • #11
    Regular Coder cineweekly.com's Avatar
    Join Date
    Aug 2010
    Posts
    485
    Thanks
    14
    Thanked 3 Times in 3 Posts
    I actually fixed the css problem by adding:
    <link href="core-style.css" rel="stylesheet" type="text/css" />
    to the php file.

    The problem with only putting the <ul> <li> part of the menu in the php file is that they incorporate css classes. So I might as well include the whole menu including the <div id=menu>

  • #12
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,333
    Thanks
    5
    Thanked 363 Times in 360 Posts
    Quote Originally Posted by cineweekly.com View Post
    I actually fixed the css problem by adding:
    <link href="core-style.css" rel="stylesheet" type="text/css" />
    to the php file.

    The problem with only putting the <ul> <li> part of the menu in the php file is that they incorporate css classes. So I might as well include the whole menu including the <div id=menu>
    Yes you can include the div as well. I just meant when creating include pages whether in php or coldfusion, you dont need to specify doc type or use the <html>
    <body>
    </body>
    </html>

    tags. just code the div and whatever you want inside the divs.

    To further understand this, load your page with working includes on it in a browser, then view the page source. Instead of the include code, you will see all the code you created in the other page. It's magic! lol
    Last edited by teedoff; 09-08-2010 at 08:32 PM.

  • #13
    Regular Coder cineweekly.com's Avatar
    Join Date
    Aug 2010
    Posts
    485
    Thanks
    14
    Thanked 3 Times in 3 Posts
    Ah, got ya. I just did that cause I was working off of an example on another site. Right now I have everything set up it seems like but the menu isn't showing up.

    I just removed the unnecessary <html><body> and placed <?php require ("menu.php"); ?> in the html where the menu used to be. The html can be seen at cineweekly.com/test.html

    On line 23 of the code is where it should call up the menu.php but nothing shows.

    EDIT: I didn't realize both files needed to be .php Thanks for your help!
    Last edited by cineweekly.com; 09-08-2010 at 08:56 PM. Reason: Resolved

  • #14
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,333
    Thanks
    5
    Thanked 363 Times in 360 Posts
    Yes, thats the beauty of server side languages. They run WITH html and are only translated by their respective servers after requested by the user. Then the severs "translate" the php or CF code BACK to plain html code. Glad you got it working!


  •  

    Posting Permissions

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