Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Scripts/Variables Troubleshooting Suggestions

10 years ago
Ugh. Don't you hate when you know you've got something right, but it won't work, so you're just as sure SOMETHING is wrong?

I'm working with the "back" feature of using items. Since the items might get used in multiple places, I'm trying to lock in where you were when you used it, and then sending you back to that place. For two items, it's working perfectly: you can use it anywhere (and when you use it, the script saves LASTPAGE), and then you can go back to where you were when you're doing (using the "Previous Page" link with a $DEST := "@P" + "%LASTPAGE" script).

However, for the third item I'm working with, I simply cannot get this to work. As far as I can tell, I've got everything in the right place. I even have it set to display LASTPAGE on every page, and that IS getting set correctly. But for some reason, when it gets to the "Previous Page" link with the script (see above), it will not go back anywhere but one page. In fact, I actually tried using the item from two different spots, and LASTPAGE shows up with different (and correct) numbers -- but the Previous Page link is ignoring the script (as far as I can tell).

Has anyone experienced this before, or have any suggestions about where else I can look to find out what I've done wrong? I've tried copying the script code directly from the item where it works to the item where it doesn't work, but no luck yet.

Scripts/Variables Troubleshooting Suggestions

10 years ago
Ah, crap again. After much further experimentation, it appears that the other instances aren't actually working, either. Maybe that makes it simple and I just need to make the link go, well, somewhere else...

Scripts/Variables Troubleshooting Suggestions

10 years ago
Have you tried just using a "Previous Page" link?

If you're just going from the page the item sends you to and back, you shouldn't need to use scripting.

Scripts/Variables Troubleshooting Suggestions

10 years ago
I had tried that, and I think that's why it worked in one place -- but in the other place, there was a second page, so going back just took you to the first page...

Scripts/Variables Troubleshooting Suggestions

10 years ago

I don't think that a $DEST can be a string. Try $DEST := @P0 + %LASTPAGE. I had a similar issue and this scheme seems to work.

Edit: Forget about that. It can be a string, but your variable needs to be treated as a number. Just get rid of the quotation marks around %LASTPAGE. ($DEST := "@P" + %LASTPAGE)

Scripts/Variables Troubleshooting Suggestions

10 years ago
Ah, whew, that was it (the extra quotes)! Awesome, thanks! Now, how to get the text fixed on this page that gave me the code that included the quotes...

Scripts/Variables Troubleshooting Suggestions

10 years ago

I believe @Sethaniel is able to edit articles.

Seth, in the Advanced Scripting article under the "Page Recall" section, can you change the code $DEST := "@P" + "%LASTPAGEID" to $DEST := "@P" + %LASTPAGEID? It would be clearer without the quotes around %LASTPAGEID.

Scripts/Variables Troubleshooting Suggestions

10 years ago

But keep the quote around "@P" ?

Scripts/Variables Troubleshooting Suggestions

10 years ago

Yes.

Scripts/Variables Troubleshooting Suggestions

10 years ago

Done.

Scripts/Variables Troubleshooting Suggestions

10 years ago
Thanks!