Gossamer Forum
Home : Products : Gossamer Links : Discussions :

<%detailed_url%> tag

Quote Reply
<%detailed_url%> tag
I can make the tag <%detailed_url%> work in the link.html template alright (as it's supposed to). Now I want to use it in some sort of inbound link inside the detailed.html template itself. I need it in order to use it in some graphic counter I want to add.

I keep getting: Unknown Tag: 'detailed_url'. How can I get LSQL to recognize that tag on detailed.html?

If you love cats - visit www.TheCatSite.com

Visit my LinkSQL based Cat Site - www.Meowhoo.com
Quote Reply
Re: [Anat] <%detailed_url%> tag In reply to
the detailed_url is set in the display link routine in SiteHTML.pm

Code:
# Set the detailed_url.
if ($CFG->{build_detailed}) {
$rec->{detailed_url} = "$CFG->{build_detail_url}/${$rec}{'ID'}$CFG->{build_extension}";
}


if you are using dynamic pages, this is then modified by the template parser.

There are a number of ways to go about solving this problem, the "best" way depends on your use, and needs.

Because this is a need localized to the detailed.html, you'd be better off creating a small function to call, and created the "detailed_url" variable. The reason is that "ID" can be different things at different times, depending on what database record you have.

The easiest way, but not portable, is just to copy that code into the detail page display routine, above the block where it checks for dynamic pages.

Part of the widgets plugin (the other plugin I'm still working on) is set to allow adding callable routines to a basic shell. This would allow simple creation of code fragments that can be called by other programs/templates.

No release date on this plugin any more, but it shouldn't be too long, since it's something I'm developing/finalizing for my own software needs, to standardize function calls and availability across all my sites.

I've got the domains perlwidgets.com and sqlwidgets.com and linkswidgets.com so it will probably be released under one of those names.

It will replace the previously described "utils".


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] <%detailed_url%> tag In reply to
ShockedSorry - most of what you said is Chinese to me (and I'm not Chinese - I'm from Israel Wink).



I am using static pages mode. So, what you're saying is I should copy that piece of code and paste it somewhere else right? Can you please just let me know where to paste it? Which file and where in that file?

I can copy and paste (CTRL+C and CTRL+V Tongue) but not much more than that...

Thank you!!

If you love cats - visit www.TheCatSite.com

Visit my LinkSQL based Cat Site - www.Meowhoo.com
Quote Reply
Re: [Anat] <%detailed_url%> tag In reply to
Ok,

In your .../admin/ area on your server, go into the : /admin/Links subdirectory.

There is a file called SiteHTML.pm. this is where all the display functionality of links is done.

FWIW: In the past, you needed a display routine for *each* template you wanted to display. This new file, allows you to use ONE display routine, but override it if you need to do something special. The link.html and detailed.html files are two that need "extra" processing. So, a different display routine is used for them, than for regular templates -- or for each other.

Keeping this in mind, that link.html and detailed.html are *NOT* processed the same as other templates, will help understand what is going on.

In these "improved" display routines, the dates are modified, and some "nice" things are done. In doing these "nice" things, it sometimes makes it hard to understand why it's not available everywhere.


That said... <G>

Edit that file. When you load that file into your text editor, you'll see the first subroutine has the lines of code in it that I posted above. I just cut them out of that file.

So, highlight and copy that block of code.

Scroll down a page or two, and you'll see you are in the "sub site_html_detailed " block of code.

you'll see the comment line "# Set the template set to use."

Paste the block of code you marked above right above that.

Make sure it all looks the same, same formatting, etc.

Save the file. Make a backup of the file on your server, then copy this new version to your server, and it should work.

If it doesn't, copy your back up file back, and let me know :)

This is very simple. All you are doing is adding a new "tag" to the display hash, but you are doing it in the base links code, rather than the user globals.txt or other file.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [Anat] <%detailed_url%> tag In reply to
Add the following to your globals ('Build->Template Globals'):
Code:
sub {
my $id = shift;
if ($id and $CFG->{build_detailed}) {
return "$CFG->{build_detail_url}/$id$CFG->{build_extension}";
}
}
and give it a name you like, e.g. 'get_detailed_url'. Then you can include the following tag on the detailed.html template
Code:
<%get_detailled_url($ID)%>

I hope that helps.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] <%detailed_url%> tag In reply to
Thanks Yogi!

As I haven't implemented either yet - which should I try first and what are the advantages/disadvantages to each method?

If you love cats - visit www.TheCatSite.com

Visit my LinkSQL based Cat Site - www.Meowhoo.com
Quote Reply
Re: [Anat] <%detailed_url%> tag In reply to
The solution with the global will survive an upgrade. I personally never (well, very seldom) touch the core Links SQL code, because virtually everything can be accomplished through 'Template Globals' and plugins.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] <%detailed_url%> tag In reply to
Yogi, I tried the global like you suggested. Adding it to the page gave the following error message:

Error: Variable 'get_detailled_url' is not a code reference

Any ideas?

If you love cats - visit www.TheCatSite.com

Visit my LinkSQL based Cat Site - www.Meowhoo.com
Quote Reply
Re: [Anat] <%detailed_url%> tag In reply to
The first five letters of the global need to be exactly
Code:
sub {
i.e. sub<space>{

Other than that, I don't know.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] <%detailed_url%> tag In reply to
Must have been my mistake somewhere. I deleted the global and edited it in a text editor so it would look more like what you pasted here (copied directly from the forum doesn't maintain the form).

It's working now Cool thanks!!!

If you love cats - visit www.TheCatSite.com

Visit my LinkSQL based Cat Site - www.Meowhoo.com
Quote Reply
Re: [yogi] <%detailed_url%> tag In reply to
In Reply To:
Add the following to your globals ('Build->Template Globals'):
Code:
sub {
my $id = shift;
if ($id and $CFG->{build_detailed}) {
return "$CFG->{build_detail_url}/$id$CFG->{build_extension}";
}
}
and give it a name you like, e.g. 'get_detailed_url'. Then you can include the following tag on the detailed.html template
Code:
<%get_detailled_url($ID)%>

I hope that helps.


I tried this to fix the bug I'm having with premium_link.html template but it didn't work. Gave me a hash.