Forum Moderators: coopster
But when i try and move this string on a seperate page, for example a pop up window, (eg <a href=somepage.php?css=thecssstring>) but because the string is so long, it doesnt work!
Is there anyway to condense the data and then spit it out again? Ive tried base64_encode but it doesnt work!
A) You cant have any spaces in any of the values or it may cause problems with the encoding
B) If you have spaces you can use the pass it like this:
$string = "This is my string";
$sending_string = str_replace(" ", "_", $string);
page.php?id=$sending_string.php
Now your string would be "This_is_my_string" which will pass find. Once your variable reaches the other page then reverse it to remove the underscore character and replace it with spaces:
$received_string = str_replace("_", " ", $id);
i.e. (in the parent)
<form name="f1" action="child.php" method=post> <input type="hidden" name="cssvalue1" value="<?=$dynamic_cssvalue1?>"> </form> <a href="javascript:document.forms.f1.submit()">Child Page</a> then in the child page:
<body bgcolor="<?=$_POST["cssvalue1"]?>"> 2) Why not save the values to the parent page and then read those values from the child (pop-up), since you're using Javascript anyway?
i.e. (in the child)
cssvalue1=opener.cssvalue1; document.bgColor=cssvalue1; or some such ...
Think of how long a normal css doc is, mine is about 250 lines long!
I've encoded strings that had spaces in them before with no difficulty!
I had a look at the mcrypt function and saw that it could condense a string into 2 chars! I also had a look at the php built in crypt function, but it wouldnt work!
In the end, I just decided to include the css parse script in the pop up window!
But i also tried having a css file created on the fly, eg
<link href="styles.css.php?id=style1" rel="stylesheet" />
But that didn't work! is there another way to incorparate such php/css stuffs or will i have to create different files?
PS thanks for all the help!
<link href="styles.css.php?id=style1" rel="stylesheet" /> becomes
<link href="<?=$thisStyle?>_style.css" rel="stylesheet" /> where
$thisStyle holds the value of the determination (like "ie_style.css" or "blue_style.css")