Gossamer Forum
Quote Reply
<li> links.html template
I would like to be able to print <li> from the links.html on certain pages (like search_results.html or category pages). However, I would like every other page (rate, review for example) to not print the <li>. I tried setting a variable <%set li = '<li>'%> in the search_results template (for instance) and printing the <%li%> in the links.html template, but that will not pass because links.html is not being loaded from an include. The only things that seem to pass to the links.html are the things in the $ENV{'QUERY_STRING'}.

Any ideas of how to accomplish this?
Thanks,

- Jonathan
Quote Reply
Re: [jdgamble] <li> links.html template In reply to
Might be just as easy to set up another link.html template with or without the <li>
i.e.link_search_results.html and in search results change to:
<%include link_search_results.html%>

The other option may be <%if category_id%><li><%else%><%endif%>

Regards

minesite
Quote Reply
Re: [minesite] <li> links.html template In reply to
...or just use a loop in your templates;

category.html =>

Code:
<%loop links_loop%>
<%include link.html%>
<%endloop%>

search_results.html =>

Code:
<%loop links_results%>
<%include link_other.html%>
<%endif%>

That way, as minesite said, its then possible to have 2 different link templates, and then you can decide which templates show which link vertsion :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] <li> links.html template In reply to
I do not quite understand the way links works with the loop statement, but wouldn't it just be as easy to say something like:

Code:
<%loop link_results%>
<li><%include link.html%>

<%endloop%>


for the ones that require <li> just use a regular <%link_results%>

Would this work or am I missing something?

- Jonathan
Quote Reply
Re: [jdgamble] <li> links.html template In reply to
Hi Jonathan

I think that would work but its very limiting in how you format and display the listing.
At the moment you just want the <li> so it should be OK.

I use the loop but inside the link.html template like:
<%loop links_loop%>
<%if Link_Type eq Premium%>
<%include link_premium.html%>
<%endif%>
<%endloop%>

<%loop links_loop%>
<%if Link_Type eq Standard%>
<%include link_standard.html%>
<%endif%>
<%endloop%>

You can also do this in the seach results so show different type listing in the results like
Classifieds, Articles, Links etc.

Regards

minesite
Quote Reply
Re: [minesite] <li> links.html template In reply to
I'm sorry, I'm lost... I don't understand why I'm doing a loop...

I tried this... and it did not print anything.

In category.html I replaced <%link%> with this:

<%loop links%>
<li><%include link.html%>
<%endloop%>

and I took the <li> tag out of link.html...

Im lost...

- Jonathan
Quote Reply
Re: [jdgamble] <li> links.html template In reply to
You wrote:
I would like to be able to print………

I wrote:
just as easy to set up another link.html template........

You wrote:
but wouldn't it just be as easy to say something like:

I wrote:
but its very limiting in how you format and display the listing.......

You wrote:
I'm sorry, I'm lost... I don't understand why I'm doing a loop.....

I’m writing:
I don’t know either, try the 1 st recommendation to your original post......

Regards

minesite
Quote Reply
Re: [minesite] <li> links.html template In reply to
Quote:
I wrote:
but its very limiting in how you format and display the listing.......

If I wanted more different formatting options I would try to set up a different template, but all I want is to display <li> at the beginning of each link, but not in my category or search template. I do not know, however, how to set up a different template right now anyway without editing original linksSQL packages. I'm trying to solve all my problems using:

A. a new perl file
B. globals.txt
C. linksSQL admin or plugins

It seems so simple, but the answer is difficult. Andy originally told me to use the loop, and I don't understand why.

I just need a push in the right direction to go about solving this problem.

Still thinking avidly,

- Jonathan
Quote Reply
Re: [jdgamble] <li> links.html template In reply to
Hi

Replace <ul><li> in link.html template with:

<%if category_id%>
<%elseif link_results%>
<%else%>
<ul><li>
<%endif%>

Replace </li></ul> in link.html template with:

<%if category_id%>
<%elseif link_results%>
<%else%>
</li></ul>
<%endif%>
to replace </li> </ul>at the end of the template also.

This should stop the <li><ul> showing in the search and categories.

If you want to email your link template I'll make the changes and email back.
PM me for the email address.

In regard to making a new template, there's really nothing to it, just need to save
link.html to new_link.html and upload that to your server default/local directory.
Or if you do it in Admin just open up the template and save as the new name by changing the "Save template as" option at the bottom.

Regards

minesite

Last edited by:

minesite: Sep 4, 2004, 3:20 AM
Post deleted by minesite In reply to
Quote Reply
Re: [minesite] <li> links.html template In reply to
The only thing that will pass into links.html is anything from the $ENV{'QUERY_STRING'}. <%category_id%> will not pass into links.html because it is not being included from an include. Now do you see my dilema?

- Jonathan
Post deleted by minesite In reply to
Quote Reply
Re: [jdgamble] <li> links.html template In reply to
Hi Jonathon

“Now do you see my dilema?”

No I don’t, I must be missing something.

Firstly, did you try any of the suggestions offered.?
And what where the results ?
Was there errors or just non display ?

Secondly, the cat id is passed to or via the category template, which is where the links are displayed.
You can do a dump to see all the variables available, search for dump in this forum for further info.

Thirdly, I just placed the following in the link.html template and displayed Category, Search and other / non.
Screenshot attached has the results.

<%if category_id%> <ul><li> if category_id
<%elseif link_results%> <ul><li> elseif link_results
<%else%>
Non link page
<%endif%>

<%if category_id%> </li></ul>
<%elseif link_results%> </li></ul>
<%else%>
<%endif%>

Regards

minesite
Quote Reply
Re: [minesite] <li> links.html template In reply to
Quote:
Firstly, did you try any of the suggestions offered.?
And what where the results ?
Was there errors or just non display ?

Obviously I did try the suggestions or I would not have responded to them with my problems.
The result, as I said earlier, is that when I place <%category_id%> in my links.html template, it will not display.

To be more specific, I get Unknown Tag: 'category_id' in my category pages.

Quote:

Secondly, the cat id is passed to or via the category template, which is where the links are displayed.
You can do a dump to see all the variables available, search for dump in this forum for further info.

The cat id is passed to the category template, I never said it wasn't, it isn't, however, passed to the link.html template which is what I am talking about. I do not need a dump to prove this, as that is what Unknown tag proves.

Quote:
Thirdly, I just placed the following in the link.html template and displayed Category, Search and other / non.
Screenshot attached has the results.


Are you sure you are talking about the link.html template, because mine does not seem to recognize the category_id tag. If you are talking about the link.html template it makes no sense to place <%link_results%> there. <%link_results%> is in your category.html template.


There has got be an easy way to insert <li> in some pages but not in others. I'm thinking of just writing a new sub routine to produce the link_results.

- Jonathan
Quote Reply
Re: [jdgamble] <li> links.html template In reply to
Hi Jonathon

"The result, as I said earlier, is that when I place <%category_id%> in my links.html template, it will not display."..............

No, As mentioned it should be <%if category_id%>
Please note the "if"

"no sense to place <%link_results%>"..........

No. As mentioned it should be <%elseif link_results%>
Please note the "elseif"



Duhhhhh... Everything I want to do that is so complicated is always shown to have the easiest method...
jdgamble - Aug 18, 2004, 8:54 AM



Regards

minesite

Last edited by:

minesite: Sep 4, 2004, 7:09 PM
Quote Reply
Re: [minesite] <li> links.html template In reply to
Right, but <%if category_id%> is going to be a null if statement if $category_id is not passed into links.html.

I tested this earlier by saying <%if category_id%><li><%else%>test<%endif%> and it printed test, of course, because $category_id is not declared.

<%link_results%> is not in your link.html though, so <%if link_results%> is an anomaly to links.html.

Anyway, it doesn't matter, I just solved my problem by placing this in links.html

Code:

<!--li-->


and I wrote this Andy-style global

Code:

'replace_li' => 'sub {
my $in = $_[0];
$in =~ s,<!--li-->,<li>,g;
return $in;
}',

<%replace_li($links)%>

So anytime I want the li to display, I can say <%replace_li($link_results)%> instead of <%link_results%> or whatever.

Thanks everyone anyway,

- Jonathan
Quote Reply
Re: [jdgamble] <li> links.html template In reply to
“Right, but <%if category_id%> is going to be a null if statement if $category_id is not passed into links.html.”

Exactly, that’s why you have <%if category_id%>

“I tested this earlier by saying <%if category_id%><li><%else%>test<%endif%> and it printed test, of course, because $category_id is not declared.”

Exactly , Its only declared in the Category Template and that’s why you have <%if category_id%>

“<%link_results%> is not in your link.html though, so <%if link_results%> is an anomaly to links.html.”

Exactly, its in your search results, so the <%elseif link_results%> <ul><li> will only show up in the search results.

“There has got be an easy way to insert <li> in some pages but not in others.…………….”

Yes there is, as mentioned a dozen posts ago.
<%if category_id%> <ul><li>
<%elseif link_results%> <ul><li>
<%else%>
<%endif%>

Glad you got it worked out.

Regards

minesite
Quote Reply
Re: [minesite] <li> links.html template In reply to
Quote:
<%if category_id%> <ul><li>
<%elseif link_results%> <ul><li>
<%else%>
<%endif%>

So you were saying put this in category template not in links template?

I already have <ul> in my category template (actually in my case I use <ol>).

The problem with the <li> is that I wanted it to be in front of each link, not in front of one link or $link_results.

But anyway...

- Jonathan
Quote Reply
Re: [jdgamble] <li> links.html template In reply to
Hi

Now I'm confused, I thought you wanted this to display in front of the links ?
" able to print <li> from the links.html"

But I see you already have this done, is this for another site or do you want it in front of the categories ?



<ol>
<li>
<font face="Verdana"><a href="http://www.magicdirectory.com/cgi-bin/jump.cgi?ID=1801">



Neat site by the way, you've done a good job.

Regards

minesite
Quote Reply
Re: [minesite] <li> links.html template In reply to
I'm in the process of upgrading from links to linksSQL.

The site I have been working on is: http://www.magicdirectory.com/linksSQL/

But anyway, <ol> or <ul> starts the list. <li> is not displayed once, but on each link.

Example.

<ul>
<li>first link</li>(not required)
<li>second
<li>third etc.
</ul>


I don't have a problem displaying the <ul> or <ol>, because it is displayed individually on whatever page (search, category, etc)... I HAD a problem displaying <li> on each link.

Quote:
Neat site by the way, you've done a good job.

Thanks, the only things I really have left to do in upgrading is to update my versions of myImage and mylinks, which I play to incorporate into the user part instead of using cookies. If I don't have time to write them I might just buy one of the plugins for favorites and use my old cookies-written code from links 2.0.

- Jonathan
Quote Reply
Re: [jdgamble] <li> links.html template In reply to
Hi

"I HAD a problem displaying <li> on each link."

The standard template which comes with the install is


<%--
File : link.html
Description : This file displays a single link. It is used on category listings,
search results, what's new, what's cool, pretty much anywhere you
see a link.
Tags : You have all the properties of a link available on this page, plus:
detailed_url => The URL to the detailed page (if enabled in admin).
isLinkOwner => True if the logged in user owns this link (used to
provide a link to the modify form).
--%>
<ul>
<li> <%body_font%><a class="category_links" target="_blank" href="<%db_cgi_url%>/jump.cgi?ID=<%ID%>"><%Title%></a></font>

<%if isNew%>



As you mentioned above, so if you can't get the <li> to display on every link there is something very wrong.

You’re Example:
<ul>
<li>first link</li>(not required) < I'm presuming you mean the </li> not the 1st link ?
<li>second
<li>third etc.
</ul>

I'd probably do the following in category.html template.
<ul>
<%links%>
</ul>

And delete the <ul> </ul> from the link.html template so it should display as your example.
And use the previous "if and else" statements to target specific area's.

Regards

minesite

Last edited by:

minesite: Sep 5, 2004, 4:02 AM
Quote Reply
Re: [minesite] <li> links.html template In reply to
I forgot the default templates had the <ul> in link.html (which would be putting it in every link).

This is bad html programming (if you call html... programming). I deleted it from my link.html template a long time ago and put it in my category template (if it wasn't already there, I don't remember the default templates to that extreme!)

I could get <li> to display with every link, I just wanted it not to display certain times.

Let me be more specific as to why I needed this mod in the first place...... (fewwww)

Ok, I want my search results to have the <li> and the category pages since they are both in a numbered list (<ol>).
I didn't, however, want my rate it, claim it, recommend it, etc to display the <li>, because it would be dealing with just one link, not a list of them (since everything on my site uses link.html to display a link ... with a few exceptions). You see the <li> in my opinion looked stupid just hanging there (the dot that is).

Hope this clears up a few things,

- Jonathan
Quote Reply
Re: [jdgamble] <li> links.html template In reply to
Well I'm glad we got that marathon sorted out. Tongue



I deleted it from my link.html template a long time ago and put it in my category template (if it wasn't already there, I don't remember the default templates to that extreme!)



Its a trap all right, your saying to yourself, where is that coming from and forgetting that you put it there, or deleted it in the first place.Tongue

The problem I've found with GT, and its not a problem at all, is its simplicity to do or change what ever you want and very easily.

We think it will be difficult, so we usually look for the complicated solutions when its just a matter of <%if I want this%>it will do this<%else%>contact andy or gt<%endif%>
Crazy

Good luck with the new site.

Regards

minesite
Quote Reply
Re: [minesite] <li> links.html template In reply to
Thanks... Hopefully, we are all only human...?!? Mad (a guy poking himself in the eyes?!_?!)

- Jonathan