Changing the value of $scripturl causes template problems?

Started by SaikoJosh, June 18, 2006, 03:53:19 PM

Previous topic - Next topic

SaikoJosh

I changed the value of $scripturl in QueryString.php to:

// Makes it easier to refer to things this way.
$scripturl = $boardurl . '/index.php?fid='.$fid;


I added the ?fid='.$fid at the end.

Therefore I had to change every link in the source files where they start $scripturl, '?var=x'; or similar. I changed the ? character to an & character to make the links work.

But now it is saying that I'm getting template parse errors? What have I missed here?

Digital Home Central - Products for the 21st century home (under construction).

Rudolf

You have to use ; instead of &.
Where do you get the template error?
I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)

Elmacik

You ofcourse will get an error because you are cutting an echo line by special characters.
Because your usage of the semi-colon is incorrect. It cuts the variable and ends the echo line without ending the URL with another semicolon.
I mean, you use '. $var; at the end which will produce a URL like: /index.php?fid=fidaction=admin
To avoid this, try using something like:
$scripturl = $boardurl . '/index.php?fid=' . $fid . ';

But it still may not work, since there will be questions marks ( ? ) in the URLs after the scripturl.

@rudiksz, & and ; are the same in this situation. Even though some servers do not accept ; so you have to use &
Home of Elmacik

Rudolf

Quote from: Elmacik on June 19, 2006, 12:35:06 AM
You ofcourse will get an error because you are cutting an echo line by special characters.
Because your usage of the semi-colon is incorrect. It cuts the variable and ends the echo line without ending the URL with another semicolon.
I mean, you use '. $var; at the end which will produce a URL like: /index.php?fid=fidaction=admin
To avoid this, try using something like:
$scripturl = $boardurl . '/index.php?fid=' . $fid . ';

But it still may not work, since there will be questions marks ( ? ) in the URLs after the scripturl.

@rudiksz, & and ; are the same in this situation. Even though some servers do not accept ; so you have to use &

If you take a closer look you will see that it is not an echo statement. So it's clear form the first look that your code will result in a compile error.
The rigth way to do was how jcoleuk did, and the result would be
url's like /index.php?fid=fida?action=admin

The SMF sets the ';' as the url parameter delimier, so ; and & is not the same inside the smf script. It will give you errors one way or another. So first thing would be that he changes all the url's in the templates at the $scripturl '?action=xxxxx' codes to $scripturl ';action=xxxxx'.
This will result in urls like: /index.php?fid=fida;action=admin  - which are perfectly legal.
If his server doesn't accept the semicolon then that's a whole different issue.

imo
I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)

Elmacik

rudiksz, you should go deeply into QueryString.php and see that SMF uses ; as a delimiter and if server wont allow, SMF will automatically change the delimiter to & instead of ;
You can try it in your site to see they both are the same.
/index.php?action=post;board=2
/index.php?action=post&board=2

Whatever, yes, his first code seems all right. But my code also wont cause errors, in my opinion of course.
Home of Elmacik

SaikoJosh

I discovered what my problem was, I was trying to cut corners and replace every '? character in all of the sources but that messes up some of the expressions, I'm currently going through all the sources and fixing the links by hand.

Thanks for the help guys. :)

Digital Home Central - Products for the 21st century home (under construction).

Rudolf

You can replace all "?action" with ";action" or "&action" - whichever works for you.
Much faster and wouldn't break other expressions ;)
I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)

Harzem


SaikoJosh


Digital Home Central - Products for the 21st century home (under construction).

Harzem

That's probably all, as far as I remember. That's why I've just posted that two additional :)

Advertisement: