Current page url and theme configuration options

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

Current page url and theme configuration options

Post by abdussamad »

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: 1331
Joined: Sun Dec 04, 2005 5:43 pm
Location: Andalucia, Spain
Contact:

Post by carl_galloway »

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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

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: 117
Joined: Fri Apr 21, 2006 10:11 pm
Location: Karachi, Pakistan
Contact:

Post by abdussamad »

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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

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: 117
Joined: Fri Apr 21, 2006 10:11 pm
Location: Karachi, Pakistan
Contact:

Post by abdussamad »

$_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: 1331
Joined: Sun Dec 04, 2005 5:43 pm
Location: Andalucia, Spain
Contact:

Post by carl_galloway »

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