View Full Version : Website news question

01-22-2010, 02:47 AM
Ok i really new to web making and i have a question i was wondering if you could help me with.

Lets say you have a website with your links on the left side and news in the middle
How can i make it so when i click one of the links at the side the middle where the news is changes but the left stays the same?

Sorry if you dont understand i will try to be more clear if you dont know what i mean.


01-22-2010, 02:50 AM
There is a few ways of doing this. With PHP you can have a template file, and it loads the page when you click on the links and shows the new content.

In javascript, it doesn't have to reload the page, and it will change.

01-22-2010, 03:02 AM
Hm now how would i go about doing the first option

01-22-2010, 03:36 AM
Will the links on the left side keep changing, or do they always stay the same?

Maybe you have a web page you can show us?

01-22-2010, 03:39 AM
The links will always stay the same.

And sorry i have not uploaded my website yet.

01-22-2010, 04:04 AM
You posted this in the PHP section ... I assume you know PHP?
And do your pages have the extension of .php (instead of .html)?

How are you doing the "news articles"?
Are those some simple text files that you upload?

The answer to your question is really depending on the structure of
your "news items" or "articles" ... when the links on the left are clicked,
how you determine which articles to show. We need more information
on what the news content is.

Maybe if you describe what your site is about ... that might help.


01-22-2010, 04:08 AM
uhm its just a little project im doing to learn php.

I want the News to be in php format because i want to add polls and stuff.
sorry i can't be that much of a help im really new to all this.

01-22-2010, 04:12 AM
Pretty much this is how i would like it to work.

Lets say i have 3 links

News (News.php)
Updates (Update.php)
Help (help.php)

When one of those are clicked i want my website to swap what is currently in the middle to whatever i click and everything else stay the same.

01-22-2010, 05:22 AM
Yeah that is just a static template. You need to build your layout (section with your links and header, footer, etc). Then build like news.php and in the middle post your news, save it as News.php and then either edit the same file or copy the same coding to a blank one and build Update and save as Update.php etc. Do this for all of them, and just change the middle content area.

After the template and pages are finished, if you want to change news from an Administrator Control Panel, you can easily and quickly convert it to read from it.

01-22-2010, 05:31 AM
OK ...

So you have your three files.

They contain any PHP or HTML you want,
but they don't contain any <head> stuff,
only content that would appear in the middle
of a page.

You have another PHP script called "header.php".
That script has your main web page header, <head> <title> <meta>, etc.

You have another PHP script called "footer.php"
That script has your main web page footer ... copyright, all rights reserved, etc.

Your main page (with the 3 links) is called "index.php".

Your "index.php" would look something like this:


// default display

// get any variables from the links


<?php include("header.php");?>


blah blah

<div id="left_column">
<a href="index.php?p=n">News Page</a><br />
<a href="index.php?p=u">Updates Page</a><br />
<a href="index.php?p=h">Help Page</a><br />

<div id="middle_content">
<?php include($display);?>

<div id="footer">
<?php include("footer.php");?>


01-22-2010, 11:46 AM
where to learn PHP tell me. I am interested in PHP.
Joliese tan (http://www.articlesbase.com/health-articles/joliese-tan-review-get-free-trial-now-1652009.htmll)

01-22-2010, 01:07 PM
You can find books on Amazon.com
or free tutorials and examples by searching on Google: PHP tutorials

01-22-2010, 01:23 PM
@ Isabellalara: This is the wrong place to ask, but buy the book "PHP for dummies", that will help you.


Working with frames is also a possibility.
This can be done in HTML or PHP.

You create a menu frame and a content frame.
In the menu frame you place a HTML or PHP page with the links.
These links point to your News, Updates and Help pages to be shown in the content frame.

Just like mlseim did with the DIVs.

In the index file:

<iframe src="menu.php" frameborder="1" height="100%" width="150" scrolling="no"

In the menu.php:

<a class="type3" href="news.php" target="_content"><font size="-1">News</font></a>

Hope this helps you further.