Gossamer Forum
Home : Products : Gossamer Links : Discussions :

detail pages with includes?

Quote Reply
detail pages with includes?
Oh, boy, I'm seeing double after looking through all the 'detail' searches.

Hence, here's my post for help...

I have two types of linkowners. Each type has different detail information. In the add link page, I've set it up where only certain fields will show up depending upon user type originally determined when they signed up (in the User table). That is working okay, but now I need to show the corresponding data in their detail page.

How can I show only the pertinent information depending upon the type of user type a or type b? I thought about an include for each type but that would only work for type a or b viewers not the general public.

I'm thinking something like:

-if linkowner TypeA show include data1-

-if linkowner TypeB show include data2-

Here's my tags I use for the different fields to show up depending upon the Type

<%if Price == 75%>

<%if Price == 130%>



I don't know how to write the code.

Any help (quickShocked) would be greatly appreciated.
Quote Reply
Re: [SSmeredith] detail pages with includes? In reply to
Don't make life hard on yourself. If all the tags are in the database, just wrap the display with <%if %> tags.

<%if user_type_A%>
.....
<%eslif user_type_B %>
....
<%else%>
default view
<%endif%>


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] detail pages with includes? In reply to
Hiya!

In Reply To:
Don't make life hard on yourself. If all the tags are in the database, just wrap the display with <%if %> tags.

<%if user_type_A%>
.....
<%eslif user_type_B %>
....
<%else%>
default view
<%endif%>


Like this?

<%if Price == 75%>
...
<%elsif Price == 130%>
...

<%else%>
default view
<%endif%>



That sounds too easyBlush.

It's those tags I have that are confusing me. I've made entire pages like your example, but my tags above are a little different and I got confused.

So the existing link is kind of tagged as either/or above so the tags will "see" the 75 or 130 values for the corresponding detail page

Let me try it out and see.
Quote Reply
Re: [SSmeredith] detail pages with includes? In reply to
MadOkay, I think the 75 and 130 tags were wrong. In the colums they've been designated pro="1" and pro="0"

I got the html to show up using the tags but they both show up instead of either or

I have:

<%if isPro="1"%>

mechant table info here

<%endif%>

<%if isPro="0"%>

services table info here

<%endif%>

and I'm getting both tables showing up together and some crazy stuff too.

maybe my HTML is off?

I'll keep trying.
Quote Reply
Re: [SSmeredith] detail pages with includes? In reply to
Try with:

<%if isPro eq "1"%>
Quote Reply
Re: [SSmeredith] detail pages with includes? In reply to
To do an equality, you need to use either == or eq as suggested.

= is an assignment operator.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] detail pages with includes? In reply to
Quote:
To do an equality, you need to use either == or eq as suggested.

= is an assignment operator.

In normal perl, but I believe the template parser supports = as a comparison operator :)

Also eq should be used for strings and == for numerics.

Last edited by:

Paul: Jan 30, 2003, 4:27 AM
Quote Reply
Re: [Paul] detail pages with includes? In reply to
Paul,

again... what should work, and what does work, are often two different things ;)

I find I use 'eq' a lot more, since it works regularly, and treating 1 as a string, or a numeric in simple comparasons makes no difference.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] detail pages with includes? In reply to
Quote:
I find I use 'eq' a lot more, since it works regularly, and treating 1 as a string, or a numeric in simple comparasons makes no difference.

You may not notice but it does make a difference which is why the perl developers implemented eq and ==.

GT::Template builds the template as perl code and then evals it as perl code and so the correct usage is important for correct results.

eq does a comparison based on the ASCII value of the operands. This means that the string "10" will sort before "2" because "1" has a lower ascii value than "2"

Thats why you should use the operators as intended.

Last edited by:

Paul: Jan 30, 2003, 5:59 AM
Quote Reply
Re: [Paul] detail pages with includes? In reply to
Paul,

I realize this, but we are looking at a test of equality.

If you trying to see if a string field holds a '1' or a '0' eq works just fine. If you are trying to see whether a numeric field holds a 1 or a 0, in perl, 'eq' works just fine too.

In fact, in the template parser, from what I remember of all the versions I've tested, for the 1/0 test, 'eq' works more reliably -- due to perl's wonderful way of thinking everything is a string -- than the == or other tests.

Again, it's a difference between what is, and what should be, what theoretically works, and what does work.

For "strict" syntactic correctness, the only wrong statement here is using '=' since that is an equality operator, even inside a conditional test ie: should evaluate to '1' every time.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: detail pages with includes? In reply to
Well, I think my point is moot in this case -

Just realized my detail pages are static. So...would that mean that any kind of database tags such as these just wouldn't work.

Maybe I need to look at Yogi's pagebuilder plugin to make separate detail pages? But would they not work either if I'm calling information from the database?



Any suggestions.
Quote Reply
Re: [SSmeredith] detail pages with includes? In reply to
Hi,

I never generated static detail pages, after the first few months, any way.

I *think* my detail_page.cgi will generate proper detailed.html code for static sites, if it's called from your static templates.

I'm pretty sure this is why I wrote it <G> I needed a way to display the detail pages dynamically, so I didn't spend hours upon hours generating them, yet have the ability to staticly generate the rest of the site.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] detail pages with includes? In reply to
Oops, credit to you on that plugin Pugdog. Sorry about that.

But I am running dynamic pages, and I'm pretty sure the detailed pages used to be dynamic also, does that sound right.

For now I just took the darn detailed link off of the link.html page.Frown

I really need to take a "vacation" to Canada for that suggested training session.Blush
Quote Reply
Re: [SSmeredith] detail pages with includes? In reply to
Ok,

If you are running a dynamic site, you turn detail pages on, and make sure you use the <%detailed_url%> tag instead of the static link. If you don't use that tag, you get a link to the static page, rather than the dynamic one.

You can replace that tag, with the detail_page.cgi, and get some additional functionality, plus an easy script to hack on that survives Links upgrades.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.