...

View Full Version : How can I have updates on every page without using iframe?



cineweekly.com
09-01-2010, 12:26 AM
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.

teedoff
09-01-2010, 01:46 AM
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.

Major Payne
09-01-2010, 07:51 AM
Server Side Includes (http://en.wikipedia.org/wiki/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.

cineweekly.com
09-02-2010, 04:25 AM
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.

Lerura
09-02-2010, 04:37 AM
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.

wincode
09-02-2010, 05:17 AM
Here's a php code as an example:


<?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.

cineweekly.com
09-05-2010, 07:18 PM
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.

Major Payne
09-05-2010, 09:01 PM
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 (http://www.htmlbasix.com/includes.shtml#taggen)

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

cineweekly.com
09-08-2010, 08:00 PM
Here's my menu in a php file:
cineweekly.com/menu.php

How do I get this to appear on my pages?

teedoff
09-08-2010, 08:17 PM
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

cineweekly.com
09-08-2010, 08:27 PM
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>

teedoff
09-08-2010, 08:29 PM
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

cineweekly.com
09-08-2010, 08:34 PM
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!

teedoff
09-08-2010, 09:27 PM
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!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum