Serendipity-Buch

Handbuch für Serendipity bestellen

Das offizielle, umfassende Serendipity-Handbuch für Einsteiger und Profis ist nun im Handel und kann online bei Amazon oder OpenSourcePress, oder auch bei jedem Buchhändler, bestellt werden!

Forum-Information

Before posting about errors, make sure that the answer cannot already be found in our FAQ or by searching this forum!
Posting is restricted to registered users (registering is free and simple!) due to recent spam attacks. When having trouble with this board, contact garvin(-at)s9y(-dot)org.

Board index Themes Current page url and theme configuration options

Skinning and designing Serendipity (CSS, HTML, Smarty)
abdussamad
Regular
 
Posts: 103
Joined: Fri Apr 21, 2006 10:11 pm
Location: Karachi, Pakistan

Postby abdussamad » Mon Dec 11, 2006 4:49 am

Hi

I have a few questions regarding templates.

How do you tell the url of the current page the user is viewing? I would like to be able to refer to this url in index.tpl or a theme's config.inc.php

How do you specify options for radio buttons in the theme configurator? select_values does not seem to work:

Code: Select all
$template_config = array(
    array(
        'var'           => 'header',
        'title'         => XYZ_HEADER,
        'description'   => XYZ_HEADER_DESCRIPTION,
        'type'          => 'radio',
        'default'       => "a",
        'select_values' => array("a"=>"a","b"=>"b")
    )

   
);


Thanks

carl_galloway
Regular
 
Posts: 1328
Joined: Sun Dec 04, 2005 6:43 pm
Location: Andalucia, Spain

Postby carl_galloway » Mon Dec 11, 2006 6:31 am

I can help with the radio button code

Code: Select all
    array(
        'var'           => 'header',
        'name'          => XYZ_HEADER,
        'description'   => XYZ_HEADER_DESCRIPTION,
        'type'          => 'radio',
     'radio'         => array('value' => array('a', 'b'),
               'desc' => array('a', 'b')),
        'default'       => 'true',
    ),

As for the current url, I've been using the $view variable and other hacks within index.tpl, the Hemingway template demonstrates my approach, but if you figure out how to do this in config then I'll be interested in snatching your solution :D

Cheers

Carl

User avatar
garvinhicking
Core Developer
 
Posts: 26675
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany

Postby garvinhicking » Mon Dec 11, 2006 12:42 pm

Hi!

As for the URL, this should work:

Code: Select all
<a href="{$serendipityBaseURL}{$serendipityIndexFile}?{$uriargs}">Current URL</a>


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/

abdussamad
Regular
 
Posts: 103
Joined: Fri Apr 21, 2006 10:11 pm
Location: Karachi, Pakistan

Postby abdussamad » Tue Dec 12, 2006 1:22 pm

garvinhicking wrote:Hi!

As for the URL, this should work:

Code: Select all
<a href="{$serendipityBaseURL}{$serendipityIndexFile}?{$uriargs}">Current URL</a>


HTH,
Garvin


Hi Garvin

What about when url rewriting is in effect? How do I tell that url rewriting is in effect and how do I refer to the rewritten url?

Thanks

User avatar
garvinhicking
Core Developer
 
Posts: 26675
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany

Postby garvinhicking » Tue Dec 12, 2006 1:30 pm

Hi!

The posted URL should work always, because it uses the fallback-URL mechanism that works on all s9y installations.

Using the rewritten URL would work if your template's config.inc.php simply assigns the $_SERVER['REQUEST_URI'] as a smarty variable and you use that one.

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/

abdussamad
Regular
 
Posts: 103
Joined: Fri Apr 21, 2006 10:11 pm
Location: Karachi, Pakistan

Postby abdussamad » Tue Dec 12, 2006 6:34 pm

$_SERVER['REQUEST_URI'] did the trick :). I wanted the url as the user sees it because that's what he's going to use when he customizes a theme's top nav bar in the admin backend. I wanted to be able to highlight the current page's entry in that nav bar. I've done that now and you should see a fresh theme release soon :wink:.

Carl and anybody else that is interested in how to refer to the current page url in config.inc.php can use this:

Code: Select all
$curpage="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];

carl_galloway
Regular
 
Posts: 1328
Joined: Sun Dec 04, 2005 6:43 pm
Location: Andalucia, Spain

Postby carl_galloway » Tue Dec 12, 2006 6:39 pm

Nicely done, can't wait to see the new template.



Return to Themes

Who is online

Users browsing this forum: No registered users and 0 guests