View Full Version : Page='s Variable
Ian Gordon
06-08-2004, 10:13 PM
Brian,
I am trying to make a $id variable so that it changes with the $page='s variable but, I am having trouble making it work
Here is what I am trying to do:
in the BODY tag of the adv_portal template I place a variable next to it $id. Now, I editted the adv_cmps_include_bottom PHP Page to setup the $id variable
Now, what I am trying to do is such:
if ($page['name'] != 'home') {
$id = 'id="tab1" class="act1"';
} elseif ($page['name'] = 'about') {
$id = 'id="tab2" class="act2';
} elseif ($page['name'] != 'database') {
$id = 'id="tab4" class="act1"';
} elseif ($page['name'] != 'media') {
$id = 'id="tab5" class="act1"';
} elseif ($page['name'] != 'contact') {
$id = 'id="tab6" class="act1"';
}
However, it doesn't appear to be working for any of the "$page['name']" variable other than the first one, can you please correct this code so it works properly! Thanks.
Brian
06-09-2004, 09:25 PM
That code doesn't really make sense to me...
if ($page['name'] != 'home') {
elseif ($page['name'] != 'database') {
Those are all saying if the page doesn't equal x.
elseif ($page['name'] = 'about') {
That should be == instead of =
Ian Gordon
06-13-2004, 05:48 AM
Doh, silly me...
ashly
06-13-2004, 06:17 AM
that cange from page- thing to id= that you can change in the options od the portal. So why your all changing the codes and so.
Ian Gordon
06-13-2004, 07:31 AM
No, don't misunderstand, I am using CSS Tabs but for them to work, I need to specify which page I am on in the <"body"> tag. Since the pages are called dynamically, I need to use a variable $IdSelector to tell which page I am on and then serve up the right HTML (i.e. id="tab1" class="act1") but, I am trying to figure out why this code, which I have now re-modified:
if ($pages['template'] == 'home') {
$IdSelector = 'id="tab1" class="act1"';
} elseif ($pages['template'] == 'about') {
$IdSelector = 'id="tab2" class="act2';
} elseif ($pages['template'] == 'database') {
$IdSelector = 'id="tab4" class="act1"';
} elseif ($pages['template'] == 'media') {
$IdSelector = 'id="tab5" class="act1"';
} elseif ($pages['template'] == 'contact') {
$IdSelector = 'id="tab6" class="act1"';
} else {
$IdSelector = 'id="tab1" class="act1"';
}
Is not working, I am trying to identify which variable is used to tell the page.
Is it: $page['template'] OR $page OR $pages or $vba_options['portal_pagevar'] I don't know...
Brian
06-13-2004, 11:28 AM
It should be $pages['name']
If that doesn't work, can you show me where you're adding that code? Other than the variables being wrong, it looks fine now. ;)
Ian Gordon
06-13-2004, 04:11 PM
So it should be:
if ($pages['name'] == 'home') {
$IdSelector = 'id="tab1" class="act1"';
} elseif ($pages['name'] == 'about') {
$IdSelector = 'id="tab2" class="act2';
} elseif ($pages['name'] == 'database') {
$IdSelector = 'id="tab4" class="act1"';
} elseif ($pages['name'] == 'media') {
$IdSelector = 'id="tab5" class="act1"';
} elseif ($pages['name'] == 'contact') {
$IdSelector = 'id="tab6" class="act1"';
} else {
$IdSelector = 'id="tab1" class="act1"';
}
Correct?
I put in the the global.php right above here:
// #############################################################################
// ######################## START TEMPLATES & STYLES ###########################
// #############################################################################
Brian
06-13-2004, 04:37 PM
Try moving it down, right above this line:
require_once('./includes/vba_cmps_include_bottom.php');
Ian Gordon
06-13-2004, 06:32 PM
Nope, not working...this is really infuriating...
Brian
06-15-2004, 11:00 AM
Sorry, you'll need to globalize that variable in the print_portal_output function as well. If you'll look for this code in your includes/vba_cmps_include_bottom file:
global $pages, $stylevar, $headinclude, $header, $footer, $vboptions, $vba_options, $navbar, $cusid, $_REQUEST;
Replace that with:
global $pages, $stylevar, $headinclude, $header, $footer, $vboptions, $vba_options, $navbar, $cusid, $_REQUEST, $IdSelector;
That should be the last thing. If that still doesn't help and you'd like to fill out a support ticket I'll be glad to take a look.
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.