Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Dynamic vs Static when developing

Quote Reply
Dynamic vs Static when developing
I am having an issue when developing my plugin to do with the differences in paths that Links creates when a user is setup for dynamic rather than static.

I can detect which they are using by looking at dynamic_pages.

The problem is I cannot safely use: $CFG->{build_root_url} when generating hyperlinks on dynamic pages. It wants to insert "page?" stuff.

Anyone come across this and have some suggestions?


Edit: Is there something I can enclose my statement in to force the build to this path literally... I mean the user has correctly specified the build_root_url. Say htttp://www.mysite.com/directory. And this would be great if when Links built the page, it just left it as that, as it does in a STATIC setup.

I prefer not to use dynamic_pages as a case statment if possible... better the same for each case!


http://www.iuni.com/...tware/web/index.html
Links Plugins

Last edited by:

Ian: Jun 6, 2002, 11:09 AM
Quote Reply
Re: [Ian] Dynamic vs Static when developing In reply to
Hi,

As long as you use Links::user_page('template.html', { vars }, { opts }) to print your template, Links SQL will automatically convert all static links to dynamic links.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Dynamic vs Static when developing In reply to
Hi Alex,

Thanks for the reply. I am not sure how I can include this, as I am actually writing to a file, and not printing to the screen?

open (OUTF, ">$CFG->{build_root_path}/editors/profiles/$editor.html") or die (qq~ unable to open File. Reason: $! ~);

Edit: in another inastance of my code I am doing this also:

$output .= qq~
<a href="$CFG->{build_root_url}/editors/profiles/$user->{Username}.html">$user->{Username}</a>
~;


http://www.iuni.com/...tware/web/index.html
Links Plugins

Last edited by:

Ian: Jun 6, 2002, 12:24 PM
Quote Reply
Re: [Ian] Dynamic vs Static when developing In reply to
I created a column in my custom table called "RootURL" and this sets itself to the users $CFG->build_root_url automatically. When checking this value on a dynamic setup it correctly shows the url as http://www.thesite.com/directory in this case. The custom column below is in the scalar $em_rooturl.

$output .= qq~
<a href="$em_rooturl/editors/profiles/$user->{Username}.html">$user->{Username}</a>
~;

the $output is returned into a global tag which is placed into the category.html template.

When the category.html template is build by links it still produces the "page?" dynamic style link in its place, despite there never being a reference to $CFG in the template.

WeirdCrazy


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [Ian] Dynamic vs Static when developing In reply to
I am still stuck on this one.

$output .= qq~
<a href="$em_rooturl/editors/profiles/$user->{Username}.html">$user->{Username}</a>
~;

$em_rooturl is made equal to the root url of the person's site manually i.e. it is not read in from$CFG->{build_root_rul}.

Yet, when this is printed onto the category.html template (as a plugin tag), the build still turns it into the dymanic style: http:blah blah/page?g=editors%2Fprofiles%2blah.html&d=1 which is not what is needed here. Just the straight url http://thesite.com/...ofiels/username.html.


How can I force my plugin tag to return the normal style url?
Unsure


EDIT: This is working great on a static directory setup... but not on the dynamic (in case I did not make this clear).


http://www.iuni.com/...tware/web/index.html
Links Plugins

Last edited by:

Ian: Jun 18, 2002, 12:05 PM
Quote Reply
Re: [Ian] Dynamic vs Static when developing In reply to
As a temporary fix for this I am trying:

Code:
#static directory or dynamic?
if ($CFG->{dynamic_pages} eq 'No') {
$output .= qq~
<a href="$em_rooturl/editors/profiles/$user->{Username}.html">$user->{Username}</a>
~;
else {
$output .= qq~
<a href="/editors/profiles/$user->{Username}.html">$user->{Username}</a>
~;
}


But this forces the dynamic users to prefix the tag manually with the correct url to the editors directory.

It should work, but not ideal.


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [Ian] Dynamic vs Static when developing In reply to
Make the tag a plug-in configuration option


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Dynamic vs Static when developing In reply to
Hmmm, interesting suggestion... I'll try that, thanks Pugdog!


http://www.iuni.com/...tware/web/index.html
Links Plugins