Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Categories listed on Modify page.

Quote Reply
Categories listed on Modify page.
Currently I have our program working through the login process. If I have a company that has 20 listings and they want to modify one of them.......you can't tell what category they are in unless you click the radio button and go into edit. See the following photo is there a way to list what categories are associated with these links?
Quote Reply
Re: [gmoney] Categories listed on Modify page. In reply to
Here is a global which I use to show category or categories below link
Hope that helps.


Code:
sub {
my ($rec) = @_;
my $id = $rec->{ID};
my $db = $DB->table ('Category','CatLinks');
my $sth = $db->select ( { 'CatLinks.LinkID' => $id }, ['Category.ID', 'Category.Full_Name'] );
my $cat;
while (my ($id,$name) = $sth->fetchrow_array) {
my $title = Links::Build::build ('title_linked', { name => $name, complete => 1 });
$cat .= "".$title."<br />";
}
return $cat;
}
Quote Reply
Re: [Payooo] Categories listed on Modify page. In reply to
May help to show how to use it Whistle

Call the global "get_links_cat_bread", and then call with:

Code:
<%get_links_cat_bread($ID)%>

(from memory, the template is modify_select.html I believe)

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] Categories listed on Modify page. In reply to
Huh Blush
Quote Reply
Re: [Andy] Categories listed on Modify page. In reply to
I'm still unsure exactly how to do that.

I'm in the modify_select.html template and there is the callout for the links loop.....I was assuming that the category code would go after the <%include link.html%> ....however I've never worked with globals so I'm a little unsure exactly what to do. Sort of new to this.

<form action="<%config.db_cgi_url%>/modify.cgi" method="post">
<%~loop link_results_loop%>
<input type="radio" name="LinkID" value="<%escape_html ID%>" class="radio"<%if isValidated eq No or isExpired or isUnpaid%> disabled="disabled"<%endif%> />
<%include link.html%>
<%~endloop%>
<input type="submit" value="Modify Link" class="submit" />
</form>
Quote Reply
Re: [Payooo] Categories listed on Modify page. In reply to
I only want to show the categories when you click on modify. Where exactly would I put that code?
Quote Reply
Re: [gmoney] Categories listed on Modify page. In reply to
Hi,

You would call it something like this:

Code:
<%~loop link_results_loop%>
<input type="radio" name="LinkID" value="<%escape_html ID%>" class="radio"<%if isValidated eq No or isExpired or isUnpaid%> disabled="disabled"<%endif%> />
Category: <%get_links_cat_bread($ID)%>

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] Categories listed on Modify page. In reply to
I put that code exactly as you had it and when I go to look at the modify links it gives me this error after the radio button

Category: Error: Variable 'get_links_cat_bread' is not a code reference
Quote Reply
Re: [gmoney] Categories listed on Modify page. In reply to
Did you add this global:

http://www.gossamer-threads.com/...ge._P308971/#p308971

...by going into Build > Template Globals, then going to the bottom of the page and putting that code into the TEXTAREA, and then "'get_links_cat_bread" as the new globals name? Whistle

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] Categories listed on Modify page. In reply to
Did exactly that and now getting

CGI ErrorThe specified CGI application misbehaved by not returning a complete set of HTTP headers.

Went and created a new global called (get_links_cat_breat) and entered the following:

sub {
my ($rec) = @_;
my $id = $rec->{ID};
my $db = $DB->table ('Category','CatLinks');
my $sth = $db->select ( { 'CatLinks.LinkID' => $id }, ['Category.ID', 'Category.Full_Name'] );
my $cat;
while (my ($id,$name) = $sth->fetchrow_array) {
my $title = Links::Build::build ('title_linked', { name => $name, complete => 1 });
$cat .= "".$title."<br />";
}
return $cat;
}

THEN WENT TO MODIFY_SELECT.HTML AND ENTERED THE FOLLOWING exactly where you told me


Category: <%get_links_cat_bread($ID)%>

Quote Reply
Re: [gmoney] Categories listed on Modify page. In reply to
Quote:
Went and created a new global called (get_links_cat_breat) and entered the following:

You called it get_links_cat_breat or get_links_cat_bread ?

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] Categories listed on Modify page. In reply to
bread

I get the cgi error then.
Quote Reply
Re: [Andy] Categories listed on Modify page. In reply to
I went back and walked through it again. Would it be because we have the login/register implemented? We don't have an open site you must login and register.
Quote Reply
Re: [Andy] Categories listed on Modify page. In reply to
We are also running version: 3.3.0 on SQL server if that makes a difference.
Quote Reply
Re: [gmoney] Categories listed on Modify page. In reply to
Try just:

<%get_links_cat_bread%>
Quote Reply
Re: [gmoney] Categories listed on Modify page. In reply to
Hi,

Mmm, using a SQL server shouldn't make any difference (although most people use mySQL)

Do you have any kinda error logs you can check? As far as I can see, the code should work fine.

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: [Payooo] Categories listed on Modify page. In reply to
Did that too and get the CGI error.....this seems like it shouldn't be as hard as it is.
Quote Reply
Re: [Payooo] Categories listed on Modify page. In reply to
finally got it to work. Moved where the call out is....Thanks a million!!!!