Gossamer Forum
Quote Reply
Unknown method as_url!!
Hello,

I try to encode ful_Name fiel in Category table without success.
The Full_name has word in latin caracters with banks as separators.
For what I read on this forum, I try try to use the as_url method but it seems that it doesn't exist in the global.txt file.

Can anyone help.

thanks in advance.

Eugene.
Quote Reply
Re: [emyavo] Unknown method as_url!! In reply to
Hi,

How are you calling it? You need to make sure it uses a table() value - for example:

Code:
$CFG->{build_root_url} . "/" . $DB->table('Category')->as_url( 'FULL_CATEGORY_NAME_HERE' ) . "/";

Hard to give a better example without knowing how you are running it though.

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: [emyavo] Unknown method as_url!! In reply to
Hi Eugene,

Can you show some code how you use it?

as_url method is not in globals.txt, it's Category table method.

It :
Code:
my $category_table = $DB->table('Category');
my $clean_name = $category_table->as_url("Full Category Name Here");

But without some example code it's hard to help.

Edit: Oops, Andy hit post button faster than me :)

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins

Last edited by:

eupos: Sep 24, 2012, 4:48 AM
Quote Reply
Re: [emyavo] Unknown method as_url!! In reply to
Thank you Andy and Eupos,

it's working like a charm now.
the as_url subroutine was not called correctly.

previous call witch generates an error (unknown as_url method):

($subcatid being a Category ID)

my $request = $DB->table('Category')->select({ID =>$subcatid})|| return $GT::SQL::error;
$request->as_url($category->{Full_Name});
my $category_path = $CFG->{build_root_url}."/".$request."/index.html";
$selection_combo .= qq~<option value="$category_path">$category_name</option>~;


simple call that works!

my $clean_name = $DB->table('Category')->as_url($category->{Full_Name});
my $category_path = $CFG->{build_root_url}."/".$clean_name."/index.html";
$selection_combo .= qq~<option value="$category_path">$category_name</option>~;
Quote Reply
Re: [emyavo] Unknown method as_url!! In reply to
as_url() is a method of the Category table object, not the statement handle.

So do:

Code:
my $Category = $DB->table('Category');
my $request = $Category->select(...);
my $clean_name = $Category->as_url(...);

Adrian