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

Preserving dynamic_preserve via plugin

Quote Reply
Preserving dynamic_preserve via plugin
How does my plugin go about preserving the dynamic_preserve options?

I have read this thread, and it seems old
http://www.gossamer-threads.com/perl/gforum/gforum.cgi?post=184364#184364

Again, this is from 2002, but do I need to be using clean_output?
Quote:
If you use Links::user_page() function it will rewrite the URL's for you automatically.

The syntax is Links::user_page('template.html', { vars }, { opts });

Alternatively you can call:

Links::clean_output (\$text);

and it will rewrite the URL's in $text.

Cheers,
Alex

It is unclear to me what I have to do to maintain the template set in via "t=template" in the url.

Currently to display a page from my plugin I do this
Code:
# Displaying a plugin page
print $IN->header();
print Links::SiteHTML::display('plugin_page', { %$input, main_title_loop => $mtl });

Do I have to setup the template differently, ie the form action?
Currently
Code:
<form action="<%config.db_cgi_url%>/plugin.cgi" method="POST">

to something like this?
Code:
<form action="<%config.db_cgi_url%>/plugin.cgi?<%if g%>;g=<%g%><%endif%><%if config.dynamic_pages =1%>;d=1<%endif%>" method="POST">

What about maintaining the template? t=foo

Thanks for any advice or help.
Chris
RGB World, Inc. - Software &amp; Web Development.
rgbworld.com
Quote Reply
Re: [rgbworld] Preserving dynamic_preserve via plugin In reply to
dynamic_preserve IS automatically preserved, even while going through a plugin.

Rather than delete my prev post, I'll explain the snag I run into when testing my plugins (2nd time now).

1) I test a plugin by calling it's script directly via the url, i.e. domain.com/cgi-bin/links/plugin.cgi. Works great.
2) Then I decide to view it using another template set, so I call plugin.cgi?t=othertemplate. This works fine (so it seems).
BUT, When I navigate to ANY other page it displays using the build_default_tpl set, dropping the t=template. boo!
3) The problem is that I never set d=1 in the initial url. Doh! Once I set d=1, it remembers t=template.

Lesson learned:
When testing a script directly via the url in dynamic mode, make sure to add d=1 to the url.

I know it's dumb, but when calling a .cgi script, I guess I just assume it's dynamic. Crazy
The key is that once I set dynamic flag, BOTH d=1 AND t=template "stick", but I gotta set d=1 first!

Hope this helps someone else.

Chris
RGB World, Inc. - Software &amp; Web Development.
rgbworld.com
Quote Reply
Re: [rgbworld] Preserving dynamic_preserve via plugin In reply to
This was a change in some recent (not too) version of Links.

Not sure why they did it, but it scewed up a bunch of scripts for awhile.

In dynamic mode, you would *think* d=1 would be set, unless d=0 was specifically passed in, but maybe that was the problem. Using hashes and such, at times d=0 might simply be stripped out, and the lack of the d= parameter was causing flakey bugs.

So rather than flakey bugs, they introduced a logic change.


PUGDOG� Enterprises, Inc.

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