Gossamer Forum
Home : Products : DBMan SQL : Discussion :

add my own pages

Quote Reply
add my own pages
Hi,

I have the feeling that the questions I am asking are much less advanced the what the others are talking about. I have looked in de DBMan SQL help pages, in this forum (and even in the Links SQL help pages, this time Angelic). Am I missing info somewhere?

A long intro for a short question: I would like to add some pages that only use my own scripts or globals (for instance to ). But I would like to use DBMan SQL for it, to be able to use things like authentication checking and the header and footer templates. So I think my question should be: Would it be possible to add my own templates (which would only call a global subroutine) and what would the URL to that page be?

Thanks, Jasper

http://www.bookings.org
Quote Reply
Re: [jaspercram] add my own pages In reply to
Hi Jasper.

When you say "add your own templates" - do you mean add a new template set, or do you mean add a new template page within an existing template set?

Adding a new template set is pretty easy - just create a new subdirectory in the templates directory and add all the relevant template files in it.

Adding a new template page to an existing set that can be called via a particular url is a bit tougher, and involves some messing around with the perl modules (those .pm files). I'm pretty sure GForum and LinksSQL have the ability to add new "actions" (what you probably need to do) through the admin panel, but the current release of DBManSQL does not have that feature, which is why you'll need to work with the perl modules. Creating a new action isn't something I've done before (though I'm going to start soon), so I can't offer too much guidance. But I think you want to add a new subroutine to the Home.pm module. That appears to be the place where these different actions are dictated. If you follow the format of the other subroutines in Home.pm, you should be able to get a particular template to load pretty easily.

I plan on working on this a bit over the next few weeks, so please keep this thread alive if you run into trouble or have any success!

Fractured Atlas :: Liberate the Artist
Services: Healthcare, Fiscal Sponsorship, Marketing, Education, The Emerging Artists Fund
Quote Reply
Re: [hennagaijin] add my own pages In reply to
I've been thinking about this since I wrote it this afternoon, and I'm now of the opinion that I probably gave you bad advice. I don't think altering Home.pm is the best way to accomplish this - I think writing a plugin is the best way to accomplish this. I'm not sure I really understood what a plugin was (from a programming standpoint) until after writing that post, but now I'm thinking that a plugin is a way to add a new perl module and instruct Home.pm and the other existing ones to "divert" to the new one and its subroutines under certain circumstances. I suppose the reason that writing a plugin is better than altering Home.pm directly is that plugins are a) reversible, and b) upgrade safe.

I'm really super new to this stuff myself, so hopefully someone from GT staff - Alex ??, TheStone ?? - will confirm or deny my newbie impressions of all this stuff, since I don't want to cause more harm than good in my effort to help here.

Fractured Atlas :: Liberate the Artist
Services: Healthcare, Fiscal Sponsorship, Marketing, Education, The Emerging Artists Fund
Quote Reply
Re: [jaspercram] add my own pages In reply to
Moderators, can one of you give an advise?

http://www.bookings.org
Quote Reply
Re: [jaspercram] add my own pages In reply to
Hi,

I'm not sure if this is what you are looking for or if it's the correct way to achieve the result but I recently did the following (and it works for me) -

I created a plugin named CustomPage that redirects to a custom html page when do=search_results&custom_page=1 is included in the url. The plugin code is as follows -

sub search_results {

my $self = shift;

# Ignores the plugin if this is not a call for custom_page

if ($self->{cgi}->{custom_page}) {

GT::Plugins->action ( STOP );

return ('/path to required directory/custom_page.html');

}

else {

#Continue with the main script search_result sub

return @_;

}

}

# Always end with a 1.

1;



For this to work you need to add a hook -

Name: search_results

Type: PRE

Code: Plugins::Dbsql::CustomPage::search_results

Position: First



Upload your custom html page to your nominated directory and try calling it up using something like -

http://www.yoursite/yourcgi/db.cgi?<%ifnot use_cookie%>sid=<%session_id%>&<%endif%>do=search_results&custom_page=1&db=tablename

Note, the plugin is very basic and may need additional coding to give you the desired result. Also, I chose the search_results sub as the place to hook in to the main script but you can use any of the valid hook in locations (MAYBE SOMEONE FROM GT WILL GIVE US A LIST AS REQUESTED IN THE PLUGIN FORUM).

I hope this helps and I also hope that someone from GT will comment on this method.

Simon.

Last edited by:

jai: Oct 17, 2002, 4:42 PM
Quote Reply
Re: [jaspercram] add my own pages In reply to
Was that what you were looking for?? Did it work for you?

Simon.
Quote Reply
Re: [jai] add my own pages In reply to
I solved it in the template itself as discussed in post 220096. But I think I can use your solution for including external scripts! Cool

Thanks, Jasper

http://www.bookings.org