Closed Thread Icon

Topic awaiting preservation: Grabbing two variables using .shtml?var1=foo&var2=bar (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12049" title="Pages that link to Topic awaiting preservation: Grabbing two variables using .shtml?var1=foo&amp;amp;var2=bar (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Grabbing two variables using .shtml?var1=foo&amp;var2=bar <span class="small">(Page 1 of 1)</span>\

 
DocOzone
Maniac (V) Lord Mad Scientist
Sovereign of all the lands Ozone and just beyond that little green line over there...

From: Stockholm, Sweden
Insane since: Mar 1994

posted posted 02-14-2002 03:01

Say, I'm going to be setting up a new website tomorrow, and I need to do something that I always over-complicate, I *know* there's easy enough ways to do this! I have most of my script set up with XSSI for apache (.shtml), and I send along a variable in the url like http://blah.com/?page1 - and then I can easily get that variable like this...

<!--#set var="which" value="$QUERY_STRING_UNESCAPED" -->

and then drop it in where I need it like....

<!--#echo var="which" -->

or send it along to the next included page like...

<!--#set var="whichPage" value="$which.shtml?$which" -->
<!--#include virtual="/content/$whichPage" -->

You get the idea. Now I need to send *two* variables along, so I can build the sub-menu from a second include. I guess I could do this with PHP too, but I've already got all of my SSI code written, and I'm looking for an easy way to get both variables. So, if I were to send ".../?page1&sub3", can anyone give me a simple way to break up those two variables in SSI? It could also be ".../?top=page1&sub=sub3" if that'd be easier. Any tips would be appreciated; this is a job for no money so I hope to knock it off in a day or two with minimum headaches, heh. TIA!

Your pal, -doc-



[This message has been edited by DocOzone (edited 02-14-2002).]

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 02-14-2002 03:43

Hmmm...on the server side, I'm not so sure there's an easy way to do that with SSI/XSSI. Both are pretty limited. Like you said, you could do this in PHP. The URL mangling would be easier, but you'd need to port your existing code over (although that's pretty simple).

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 02-14-2002 07:53

This can't be done with SSI/XSSI. You can experiment with IF statements but since you would need to include all situations you would probably end up with extremely large and extremely unreadable code (and not to mention almost impossible to write)...

IMHO It would be best to let PHP do all the work...


InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 02-14-2002 08:55

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

DocOzone
Maniac (V) Lord Mad Scientist
Sovereign of all the lands Ozone and just beyond that little green line over there...

From: Stockholm, Sweden
Insane since: Mar 1994

posted posted 02-14-2002 21:55

Yah, I'll re-write things to use PHP, I was just wondering, seems to me I worked this out once, grabbing the variables and then hacking them apart with Javascript, it was a mess, yuck. (It worked, though, heh.) I don't need to write too much, what I need it to do is pretty simple, one more enhancement on my patented "one page website" (that will nevertheless have 6 different sidebars and about 50 pages of included content), yah! I'll have fun.

Your pal, -doc-



[This message has been edited by DocOzone (edited 02-14-2002).]

DocOzone
Maniac (V) Lord Mad Scientist
Sovereign of all the lands Ozone and just beyond that little green line over there...

From: Stockholm, Sweden
Insane since: Mar 1994

posted posted 02-16-2002 07:50

OK, I RTFM, and managed to do something rather elegant, methinks! PHP is very sweet, it makes passing variables from one included page to another uneccessary, and I was able to do yet another "one page website" that now has 6 top levels, each with 3-5 sub-levels. It's actually built from a whole bunch of little pages, the main page, "test.php" holds all of the main framework, and if it gets a top level variable it'll grab the same named page from the sub-level directory of content files, and use these values to lock the mouseovers for those values. The sidebars are built from simple TXT files, nothing more than the names of the sub-levels in quotes, seperated by commas, then Javascript outputs them, with the links and the mouseover code, sweet! If I want to add a new page, all I need to do is change that one file, add an image with that name and a TXT content file, also with that name (different directories.) If I want to shuffle things around, I switch the order in the array, neato-keen!

This thing is so standardized and simple, I was thinking of playing with a PHP script to actually create the files needed to build the site, then I could have a little 'wizard' to let you add new pages or move them about, could be fun, kind of a low budget Frontpage with PHP, eh? I'm having so much fun with this!

Oh, the url, it's http://www.larkan.a.se/test.php - one of Malin's designs that we've promised to this child-care center, I did it this way mainly to make sure that the content pages are just that, nothing but basic text content, the interesting stuff is all automatic.

Ooh! I'm so darned excited about this page, and I don't even know how to explain the coolest bits, and the code (being on the server side) is all hidden away, bummer! Maybe after I sleep I'll be able to share with you what's neat about it, I feel silly right now, as in "hey! I just made a website!" ... "so what?"

I really shouldn't post after so long with no sleep, I'm pretty sure I make no sense. (But still, it's my most elegant coding job, I'm sure of it!)

Your pal, -doc-

DocOzone
Maniac (V) Lord Mad Scientist
Sovereign of all the lands Ozone and just beyond that little green line over there...

From: Stockholm, Sweden
Insane since: Mar 1994

posted posted 02-16-2002 07:56

OK, here's some code...

<?php

if ($HTTP_GET_VARS['top'] != null) {
$topLevel = $HTTP_GET_VARS['top']; }
else { $topLevel .= "startpage"; }

if ($HTTP_GET_VARS['sub'] != null) {
$subLevel .= $HTTP_GET_VARS['sub']; }
else { $subLevel = $topLevel; }

$fullUrl = "/home/www/" . $topLevel . "/" . $subLevel . ".php";

?>

<?
if (($topLevel == $subLevel) && !$includeSidebar) { @include $fullUrl; }
else { include "/home/www/templates/makeSidebar.php"; }
?>

Some of the pages will have no sidebar (a PHP var set in the little array page), that's why I only call the makeSidebar.php file if needed. that bit just uses a mix of PHP and Javascript to write the sidebar code...

<tr>
<td valign=top width=100 class=smaller><script LANGUAGE="JavaScript">

for (m=1; m<sidebarNames.length; m++) {
document.writeln("<a href=\"/test.php?top=<?echo $topLevel?>&sub="+sidebarNames[m]+"\"");
document.writeln("onFocus=\"this.blur()\"");
document.writeln("onMouseOver=\"swapSideBar("+m+",1); window.status='"+sidebarNames[m]+"'; return true\" ");
document.writeln("onMouseout=\"swapSideBar("+m+",0)\"><img width=\"100\" height=\"18\" border=\"0\"");
document.writeln("src=\"/templates/sidebarImages/"+sidebarNames[m]+".gif\"></a><br>");
}

</script></td>
<td valign=top width=16><script LANGUAGE="JavaScript">

for (n=1; n<sidebarNames.length; n++) {
document.writeln("<img name=\"S"+sidebarNames[n]+"\" id=\"S"+sidebarNames[n]+"\"");
document.writeln("src=\"/templates/sidebarImages/pips/p"+n+"a.gif\" width=\"16\" height=\"18\" border=\"0\"><br>");
}

</script></td>
</tr>

The rest of the code is just my simple little mouseover scripts. Sorry to blather on with no questions, I just gotta share this, and you're the only ones who will understand why it's cool!

Your pal, -doc-

« BackwardsOnwards »

Show Forum Drop Down Menu