Calling contact from from index.tpl?

Creating and modifying plugins.
Post Reply
carl_galloway
Regular
Posts: 1331
Joined: Sun Dec 04, 2005 5:43 pm
Location: Andalucia, Spain
Contact:

Calling contact from from index.tpl?

Post by carl_galloway »

Hi all,

I need to be able to put a static link to the contact form into my index.tpl, but there is a catch. This is for a new template that will be available for download so I need a guaranteed url even if the user has apache errorhandling, or rewrite, or nothing at all.

I've tried figuring out how the static pages sidebar plugin creates a link to the contact form which is always correct but I can't seem to duplicate this using smarty {$serendipityBaseURL}{$serendipityRewritePrefix}.

Does a method exist?

Carl
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Calling contact from from index.tpl?

Post by garvinhicking »

Hi!

A fallback method to access URLs on all rewriting methods is always:

index.php?/FULL_URL

so

index.php?/pages/contactform.html

would work on allinstallations!

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
carl_galloway
Regular
Posts: 1331
Joined: Sun Dec 04, 2005 5:43 pm
Location: Andalucia, Spain
Contact:

Post by carl_galloway »

Ok, I tried that and it doesn't seem to work. This is how it look in index.tpl

Code: Select all

<li><a href="index.php?/pages/contactform.html">Contact</a></li>
Am I doing something stupid?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

This should work, but it might depend on the permalink/pagetitle of the contact form. Maybe you'd need to use the index.php?serendipity[subpage]=CONTACTFORMTITLE method?

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
carl_galloway
Regular
Posts: 1331
Joined: Sun Dec 04, 2005 5:43 pm
Location: Andalucia, Spain
Contact:

Post by carl_galloway »

gee this isn't my lucky day, using the code as provided by you doesn't work, is the CONTACTFORMTITLE something that can be used to form a URL? Is there another variable instead?

Sorry about this, I just want to push the envelope with this template.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

The CONTACTFORMTITLE needs to be replaced with the title ofthe contactform page you configured in the contactform plugin, AFAIK.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
carl_galloway
Regular
Posts: 1331
Joined: Sun Dec 04, 2005 5:43 pm
Location: Andalucia, Spain
Contact:

Post by carl_galloway »

mmm, and that's a problem. I'm doing this for a template that will be freely available for all users of s9y and I need to be able to code a full-proof method of getting the contact form url without having to get the user to do anything. If I was able to find out what the user calls their contact form by doing a database lookup, or by using some outputted variable from the contact form plugin then I could use your solution, but if I can't do that then I need another solution.

Sorry to be painful, I just want to increase usability.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Aaaah! Now I understand!

Yes, there is no way to get it, since users are able to customize the URLs for their contact form(s). Since its even possible to have multiple contact forms, to which one would you want to link to?!

The only way that you can surely get it to work is to make your config.inc.php either query the database, or create an event plugin that fetches all contact form plugins and inserts links to used plugin hooks.

I'm really sorry, but this is going to be both a technical solution, and it needs some conception :)

Bestregards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Another thing to think of: What happens if the user has not installed the contact form plugin at all?

You could put PHP into the config.inc.php of your template to fetch the pagetitle/URL to save it into the default value of an input field where a user should enterthe URL to the contact form. Then the query would only be send qwhen configuring. Of course this means it can't be used until the user "configured" his template intially.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply