Relative route and PHP code on the Link

Hi there,
I
m triying to configure a link to a View of a Form i've just made with Formulize.

The problem is, that the php code doesn't seems to work on the "Link" option. Im using something like <? XOOPS_URL . “/modules/news/index.php” ?> as the Readme says, but, the link goes to
http://validxoopsurl/%3C?XOOPS_URL%4C./.../index.php
not recognizing the "<?" Tag. (neither "

If i leave only the /modules/news/index.php part, it works only as an append of the actual Xoops URL, so if i go inside a module and click my iMeny Link, it wil go to http://validxoopsurl/modules/ActualModule/modules/news/index.php

What can i do?

Thanks in advance.

Comments

That's really odd, shoudl be working

Hello,

I'm not sure what to say here. We use this kind of entry in menus all the time:

<? XOOPS_URL . "/modules/formulize/index.php?fid=1" ?>

I notice in your example, you have smartquotes and not regular quotes, ie: the angled quotes and not normal ones. If that is the same as the quotes you have in this menu entry in iMenu, then maybe that is screwing up the interpretation of the PHP code. But other than that, I'm not sure what could be the problem. This notation has been valid in iMenu for a really long time, so unless you're using a really old copy of the module, I don't know what the problem could be.

If you have quotes around the XOOPS_URL part, that would be a problem. Also, you may need a space after the <? and the XOOPS_URL. Also, XOOPS_URL needs to be spelled correctly of course.

You're saying that when you put in a regular bit of text the menu isn't working either? ie: if you put this as the link for the menu entry, it doesn't work?

http://validxoopsurl/modules/formulize/index.php?fid=1

Literal URLs should work just fine.

If you want to go into the code to see what's going on here, the place to look is in the modules/iMenu/blocks/imenu.php file, and look around in the executeLink function.

It should return two things, the $executeIt value which just indicates if the link should be evaluated as PHP code or not. And then the actual text of the link (minus the <? tags, etc). The link is stored in $executableLink.

If you put a print link in that function right before the return statement, and make the print line look like this:

print "Original Link: $link
Executable Link: $executableLink
";

Then when the iMenu block renders, you should get a listing of all the links that are in the block, and their original values from the database, and the interpreted values after the tags are stripped off. That should be some clue. If you do that and paste in the text that gets printed on screen exactly, that may be a big clue to what's going on here.

Good luck, I hope this helps,

--Julian

It was the quotes.

Sorry for the silly mistake and make you worry.

I used to copy the Readme file example (wich is in angled quotes)... That was all the reason of getting a broken link. =S sorry for that pal. Anyways, thanks for explaining how iMenu works =) it was great for me to play around a little bit with the code and realize how well done it its ;)

Cite:
You're saying that when you put in a regular bit of text the menu isn't working either? ie: if you put this as the link for the menu entry, it doesn't work?

http://validxoopsurl/modules/formulize/index.php?fid=1

With that case, it works perfeclty. What i ment to say was that when you put a link like "modules/formulize/index.php?fid=1" (without the XOOPS_URL tag) it will append that link to the actual xoops url. So lets say that you are adding information to a form. The actual xoops url would be something like "http://www.freeformsolutions.ca/modules/formulize/index.php?sid=4". If you click on the iMenu link, you will go to "www.freeformsolutions.ca/modules/formulize/modules/formulize/index.php?fid=1" adding the configured Link to the actual URL. Im not saying its wrong, but i think that the XOOPS_URL tag could be implicit if you put a link like that.

Julian, Thank you very much.

Interesting idea

Good point, if there is no http:// in the URL, then make the XOOPS_URL implicit, that's a good idea. That's a much nicer syntax than having to put tags or XOOPS_URL into the link itself. I'll add that for 3.1.....

Done. It's in SVN now.

Thanks! :-)

--Julian