PDA

View Full Version : Conditional Counundrum!


bobbo
07-15-2004, 03:19 PM
OK, I've read all the threads I can find on condtionals with VBA CMPS. I've managed to solve a few of my conditional coding needs, however one keeps coming back to bite me and I can't figure out what I am missing....

I am sure there are a few methods to do what I am trying to do, however if we can assume we want to do it the way that I describe here, perhaps someone might be able to help me find a solution that will also assist me in other coding areas.

Let's say that on my home page under my navbar menus I want to have some content that only shows up on my cmps_index home page. In my specific example, this content happens to be a cool embedded flash file.

Now, lets say that I want the code for this content to reside in my navbar template. The main reason I choose this location is because I wanted my flash document to spread across the 3 columns below that contain my VBA blocks...

Again, I assume there are multiple ways to make this work, but assuming this method, I would need to wrap conditionals around my flash code so that it only appears on my home page and none of the other VBA CMPS pages that I have created, nor the rest of the site for that matter....

I know that <if condition="THIS_SCRIPT == 'adv_index'"> will allow me to choose any page that renders from the cmps_index.php file. However, I only want the home page.

I've tried various conditional variations and have found (Thanks Brian) that if I use:

<if condition="$pages['name'] == 'pagenamehere'">Flash Content</if>

It works within the realm of a module/block however, the same conditional will not work from within the navbar template.

Do I simply need to somehow reference the $pages variable somewhere else in a different VB3 file to make it more global? Also, I'm not sure if this has any relevance, but I run my cmps_index.php from outside the /forums directory.

As always, I appreciate your ideas.

Bobbo

bobbo
07-15-2004, 03:32 PM
Oh My! I figured it out. I guess sometimes you simply need to write out your thoughts in order to think with a clear head and then you resolve your own problems...

I added $pages to the global line in the Ad Navbar Function in the vba_cmps_include_bottom.php file and that resolved the problem.

Perhaps the next version could add that variable in there so that people could customize their menus based on different pages... I would think that one might come up often.

Ah well, thanks for listening. lol

Bobbo :-D

Our Sponsors
 

Brian
07-15-2004, 03:39 PM
Try opening your forum/includes/vba_cmps_include_bottom.php file and look for:

global $vboptions, $vba_options, $vbphrase, $stylevar, $bbuserinfo, $show, $pmbox;


Replace that with:

global $vboptions, $vba_options, $vbphrase, $stylevar, $bbuserinfo, $show, $pmbox, $pages;

And that should allow you to use the $pages variable in your navbar. ;)

bobbo
07-15-2004, 03:43 PM
LOL, Thanks Brian. I know I didn't give you too much time to reply before I already figured it out. Good to know I'm on the right track though!

Thanks for a great system.