Conditional Arguments with different search queries

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
m u r
Forum Newbie
Posts: 10
Joined: Sat Jun 02, 2007 2:58 pm

Conditional Arguments with different search queries

Post by m u r »

I have a conditional argument set up in the header of a wordpress blog, so it loads a slightly different file (actually, it's the same file but with a different query string). The browser seems to glaze over the conditions on the first time and loads the default file as though there is no search query. It works fine when I refresh or go to it again. Please help if you can...this is very very frustrating.

Below is my code:

Code: Select all

<?php
if(in_category(4)){ echo '<param name="movie" value="http://mydomain.com/file.swf?portfolio=1" />';}
else if(is_page(2)){ echo '<param name="movie" value="http://mydomain.com/file.swf?about=1" />';}
else { echo '<param name="movie" value="http://mydomain.com/file.swf" />';}
?>
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: Conditional Arguments with different search queries

Post by aceconcepts »

You're going to have to give a little more insight if someone's going to help out.
m u r
Forum Newbie
Posts: 10
Joined: Sat Jun 02, 2007 2:58 pm

Re: Conditional Arguments with different search queries

Post by m u r »

Sorry. I am trying to have a flash header that varies depending on which page you are on. I have it set up in Flash to do something special depending on which search query is at the end of the url. I then used php and wordpress conditional statements to load a different .swf url (different search query) into the header. It works most of the time, but if you go to a page the first time, it seems to skip the conditions and go to the default.
m u r
Forum Newbie
Posts: 10
Joined: Sat Jun 02, 2007 2:58 pm

Re: Conditional Arguments with different search queries

Post by m u r »

It might be a flash issue as it seems to be pulling up the right url. If I copy and paste the URL, it comes up with something else. :banghead:
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: Conditional Arguments with different search queries

Post by Eran »

some browsers cache flash requests very hard. try to provide a random element to the URL to force the browser to get fresh results, something like '&r=349584' where 'r' is a randomly generated number
m u r
Forum Newbie
Posts: 10
Joined: Sat Jun 02, 2007 2:58 pm

Re: Conditional Arguments with different search queries

Post by m u r »

Sorry, but it seems like it is caching it, but I didn't understand your solution or how to achieve it.
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: Conditional Arguments with different search queries

Post by Eran »

You are passing a URL, for example "http://mydomain.com/file.swf?about=1"

Add a random part at the end of it, for example

Code: Select all

echo '<param name="movie" value="http://mydomain.com/file.swf?about=1&r=' . mt_rand(1,1000000) .  '" />';
m u r
Forum Newbie
Posts: 10
Joined: Sat Jun 02, 2007 2:58 pm

Re: Conditional Arguments with different search queries

Post by m u r »

After doing every possible thing I could find to prevent caching, I think it was an actionscript error. I did a bunch of "if" statements rather than an if-else if-else statement. I'm learning :)
m u r
Forum Newbie
Posts: 10
Joined: Sat Jun 02, 2007 2:58 pm

Re: Conditional Arguments with different search queries

Post by m u r »

ahhh!!!!! still not working.
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: Conditional Arguments with different search queries

Post by Eran »

maybe you should post your actionscript code under the client-side forum
m u r
Forum Newbie
Posts: 10
Joined: Sat Jun 02, 2007 2:58 pm

Re: Conditional Arguments with different search queries

Post by m u r »

The php code that uses conditional statements to pull up a different url seems to be working. I finally made different Flash files for each page (4 total). On the first frame, I have something telling it where to go:

gotoAndPlay("about"); (varies slightly depending on which flash file)

The first time you pull up that page, it pulls up the correct URL (ie. about.swf) but it is as though it skips that first frame where it tells it where to go. After I visit a page once, and I go back to it, it's fine. :banghead:

Please help me! It's driving me insane.
Post Reply