PDA

View Full Version : Passing a URL variable into a PHP include?


wakalapi
11-10-2005, 12:16 AM
RE: replace an iframe that has a static reference with a php include that has a dynamic reference

I made a module that simply uses an iframe to display the Calendar. It is located at http://www.powwowtime.com/modules.php?name=Calendar. Viewers can manipulate the Calendar within its iframe, but I would rather like to replace the iframe with a PHP include that passes variables to the Calendar.
:banana:

In other words, I would like to have users view something like

"(powwowtime.com)/modules.php?name=Calendar&cat=2&mo=12&yr=2005"

and have

"?cat=2&mo=12&yr=2005"

be appended dynamically so that the included file results as

"(powwowtime.com)/calendar/demo.php?cat=2&mo=12&yr=2005"

And then, what about the nav buttons? If they are powered by the hidden source code, I suppose I could just turn off their display in the admin panel and write my own navigation into their place on the template.

wakalapi
11-10-2005, 02:39 AM
OK I experimented with ve9gra's module and it displays nicely ... the multi-calendar's nav links appear to be relative to where it *thinks* it is residing and since I probably cannot change that, I might see if mod_rewrite can tell Calendar (or just those links) a lie about where it is.... or maybe the easy way (lol) is to turn off the nav links and put a couple of drop-down menus and a GO button that will fill in the variables.

ve9gra
11-10-2005, 08:37 AM
It would seem that you've managed to get it going...

You might want to use the $thisFile variable in config.inc.php. Change it to the name of your page (modules.php?name=Calendar). That way you shouldn't need to use mod_rewrite.

wakalapi
11-11-2005, 03:29 AM
So I just add this key to the current list:

$thisFile="modules.php?name=Calendar"

UPDATE:

The above idea was great but it caused an additional "?" to appear after Calendar. So while Nuke ignored variables following it, so did Calendar. Don't ask me why, but I originally coded a multi-calendar display for 1x1 (one rows of one calendar). Okkkk .. so .. I changed it to a normal calendar, whose navbar I noticed already passes variables correctly. Problem solved.

However, the filter plugin didn't do so, but I found that the following line added to the drop-down form works like a charm:

<input type="hidden" name="name" value="Calendar">

I now have the Calendar doing exactly what I want it to do .... for now.

ve9gra
11-11-2005, 09:26 AM
Great! and about my previous suggestion, I think the fix for that is to add a & at the end... like this

$thisFile="modules.php?name=Calendar&"

That should take care of that if you ever needed it.

wakalapi
11-11-2005, 02:11 PM
I tried that, too. I ended up with:

(url...)modules.php?name=Calendar&? (etc.)

The question mark will get tacked on at the end of whatver you put there
$thisFile="asdoiuyasioduyaoyaiyo@#^&"
You'll get (url...) asdoiuyasioduyaoyaiyo@#^&?

The normal calendar is just fine and I don't have to fight with it. It's just the multi-calendar that did that and I only use that option on a printable calendar template that is displayed outside of CMS. So it's all good!

Thanks for your suggestions.

ve9gra
11-12-2005, 09:26 AM
Note to Brian, make sure that the navigation arrows for the multi calendar use the same GET variable checking routine as the ones for the small calendar.