View Full Version : Dynamic parameters in url break script

08-15-2009, 07:25 PM
1) Script Title: Accordion Content script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ddaccordion.htm

3) Describe problem:the script is working great on a page yadayada.com/index.php but on that page I have a php driven directory that will refresh to itself using parameters in the url such as yadayada.com/index.php/454

I am wondering if someone can help with giving me direction as to what the best workaround would be. I was thinking of putting the Accordian script inside an i-frame> Is that practical? Or is there a fix I can make right in the Accordian congurations to perhaps hardcose in the url? Actually I just discovered it breaks just with an addition of a slash the the end of the url, without parameters. which led me to realize it is brealinking because of the rather different way I transport variables. Linux servers have the characteristic to move across the url from right to left and skip folders that it doesn't find. in this case, I have sent variables using this method instead of get and it is breaking the javascript
I don't think I'll get help in the forum with this issue. I'll try an iframe or mod rewrite or something.
Thanks though



08-16-2009, 11:42 AM
When you say the script breaks when the page changes URL but stays on the same page, are yo talking about the persistent feature of the script, or break as in all together not working?

08-17-2009, 01:07 AM
By break I mean it seems to like the javascript stops working because it shows all the messages as text only. I am using I-frames and for this application that will work fine. But here are the details that cause the break:

The problem has to do with the way I send my variables through the url. I don't use get or post, but for search engine friendliness I use a system where I append the variables after the file name as in index.php/var1/var2/var 3 etc. I discovered your script can handle standard php urls without a problem as like index.php?var1=var1. But even a simple slash at the end of the url such as index.php/ will causeand reproduce the error I am getting. I opted for the I-frame work around because the script that uses the /var1/var2 system also has some complex pagination that would be a nightmare to recode using the traditional ?var= system. I'll leave it to you whether to try a fix for the javascript is warranted or not but my problem is solved and I really do appreciate the time you took to follow up with it.


08-17-2009, 08:19 AM
If "index.php/var1/" and "index.php?var1=var1" both load the exact same page with the Accordion menu on it, the only thing that should "break" with the script should be the "Select Header based on URL parameter (http://www.dynamicdrive.com/dynamicindex17/ddaccordion_suppliment.htm)" feature. The menu itself should continue to function as far as expand/contract when clicked on. Or perhaps I'm misunderstanding the issue.

08-17-2009, 01:21 PM
Hi, Here is a url demonstrating the issue.


Remove the slash at the end and the script works fine. But I need the capability for what I am doing as I need the directory menu below the accordian to work also..

Here is a url demonstrating the placement of the accordian in an i-fram (there are two different accordians in this one)


I tried it with and without the AJAX and that does not have any affect.

The error can't be reproduced on your site, however, since the demo is on an html page.

Like I said, maybe there is a real simple fix beside the i-frame that I used. One concept that I ran across might offer a fix by putting the javascript inside "disappearing" divs or something along that linwe. Thats just a preliminary thought. I am not that up on Javascript nor CSS yet (more experience with the PHP).

Thanks again for the reponse


08-17-2009, 09:23 PM
Try changing the reference:

<script type="text/javascript" src="ddaccordion.js">

so it's an absolute URL, for example:

<script type="text/javascript" src="http://www.mysite.com/ddaccordion.js">

Where "http://www.mysite.com/ddaccordion.js" obviously should be changed to correctly point to the .js file on your server.

08-17-2009, 11:05 PM
That is AWESOME! That fixed it. And hey, that was above and beyond as far as support goes. That was not an issue with your script and I really appreciate the extra effort you put in. Now I can get rid of the i-frames. It looks a lot better without them.



08-18-2009, 07:29 AM
You're welcome. :)