Forum Moderators: coopster

Message Too Old, No Replies

content change

changing only content in middle column

         

jbert

3:53 am on Jul 22, 2008 (gmt 0)

10+ Year Member



I am new to this forum but it looks like a great place to learn. I have a 3 column css layout. the left col is a menu, center is content and right is all other. I want to change the content only when a menu item is clicked. The menu items are just normal line items with ahref for each line.

I made a php content only page for each menu item

index.php is main page. lets use aboutus.php as the content change.

Here is what i tried but content did not come in


<li><span class="menu_r"><a href="index.php?file=sidebars/sepia.php" target="_self"><span class="menu_ar">Home</span></a></span></li>

The sidebar/sepia.php would be the content. If this is right it is maybe the include statement in the 'content ' DIV that is wrong

Thanks so much for any post to this.

Jim

Sekka

8:38 am on Jul 22, 2008 (gmt 0)

10+ Year Member



On each link within your menu, you need to pass a unique identifier, for example,

<a href="index.php?s=about" target="_self">About</a>
<a href="index.php?s=contact" target="_self">Contact</a>

Note: It is a very bad idea to pass paths within the URL as your website could easily be XSS'ed, hence why I have used key words.

Now, within your content area, you want something like the following,

if (isset ($_GET['s'])) {
switch ($_GET['s']) {
case "about":
require_once ("some/sectioncontent.php");
break;
case "content":
require_once ("some/sectioncontent.php");
break;
default
// Error 404
break;
}
} else {
// Error 404
}

jbert

11:08 am on Jul 22, 2008 (gmt 0)

10+ Year Member



Thanks you so much for the info and especially the note. I will work with this and get back to you

Jim

jbert

5:28 am on Jul 23, 2008 (gmt 0)

10+ Year Member



Sekka, worked like a charm, thanks so much for the lesson.

jbert

6:00 am on Jul 27, 2008 (gmt 0)

10+ Year Member



I am completely lost right now. Link to the site I am working on is below. When you open the site the index.php center column has 2 rows of 3 images. When you click, say the first menu item ( home ), it will add text between the rows in the center column. When complete each menu item will do that. My question is this. I want the opening page to be what displays when the home menu link is clicked. If you look at the code you will see the php section in content that changes out the text. Hope this is clear.

<snip>

Thanks

Jim

[edited by: dreamcatcher at 7:56 am (utc) on July 27, 2008]
[edit reason] No urls please! [/edit]

jbert

6:40 am on Jul 27, 2008 (gmt 0)

10+ Year Member



I got it to work like this, may not be the best way, but worked. I made a duplicate of the index.php page called index2.php. All menu items except the home use the index2.php. This was the content is always cleared.

Thanks

Jim