Jump to content

I think variables...?


ItsWesYo

Recommended Posts

Look at attached graphic to help.

----------

 

I'm looking for an easier way to make a "bread crumbs" type thing.

 

EXAMPLE:

 

about.php

haha.php

test.php

 

I was trying to be hopeful to make a page called "variables.php" or "youarehere.php".

On that page, I would put would put:

 

about.php -> "Home > About"

haha.php -> "Home > Haha"

test.php -> "Home > Test"

 

After that, I could include "variables.php" or whatever on the layout, and when that page comes up, it would go into variables.php and look for that page and give out what it says.

 

I might have to show you the whole layout code (header.php, footer.php) if you need it.

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/110164-i-think-variables/
Share on other sites

sounds complicated. why not just check what page you're on and then include or echo out. But then again, maybe I'm not following you.

 

<?php

$page = $_SERVER['REQUEST_URI'];

 

switch($page){

case '/page1.php':

include('whatever');

echo 'whatever';

break;

case '/page2.php':

include('whatever');

echo 'whatever';

}

?>

Link to comment
https://forums.phpfreaks.com/topic/110164-i-think-variables/#findComment-565365
Share on other sites

Guest Xanza

the php switch is definitely the more practical way, but i like to use $_GET so I can customize my own urls.

 

<?php
/*
usage will be http://site.com/navagation.php?p=contact => contact.php
*/

$page = $_GET['p'];

if($page == 'home'){
include('index.php');
}

if($page == 'contact'){
include('contact.php');
}

if($page == 'about'){
include('about.php');
}

if($page == 'prices'){
include('prices.php');
}

if($page == 'quote'){
include('quote.php');
}

?>

 

but that won't help you for breadcrumbs, however this will: http://www.evolt.org/article/Breadcrumbs_for_PHP_Lovers/17/4455/

Link to comment
https://forums.phpfreaks.com/topic/110164-i-think-variables/#findComment-565379
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.