Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-01-24 10:59:21

makss
Plugin Author
From: Ukraine
Registered: 2008-10-21
Posts: 355
Website

Bit usability with css tag

<txp:css /> tag return values such as link or url, but to get the name of the css style – it is impossible.

I suggest to extend the attribute format with value name. This is useful for external css styles.

What do you think?

.

patch :)

	function css($atts)
	{
		global $css;
		extract(lAtts(array(
			'format' => 'url',
			'media'  => 'screen',
			'n'      => $css, // deprecated in 4.3.0
			'name'   => $css,
			'rel'    => 'stylesheet',
			'title'  => '',
		), $atts));
		if (isset($atts['n'])) {
			$name = $n;
			trigger_error(gTxt('deprecated_attribute', array('{name}' => 'n')), E_USER_NOTICE);
		}
		if (empty($name)) $name = 'default';
		$url = hu.'css.php?n='.$name;
// added 3 lines
		if ($format == 'name') {
			return $name;
		}
// patch end
		if ($format == 'link') {
			return '<link rel="'.$rel.'" type="text/css"'.
				($media ? ' media="'.$media.'"' : '').
				($title ? ' title="'.$title.'"' : '').
				' href="'.$url.'" />';
		}
		return $url;
	}

aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)

Offline

#2 2012-01-24 11:04:24

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Bit usability with css tag

I don’t know why someone would want to know the name of the style sheet, but you can in fact return. Not with <txp:css />, but with page_url. I.e.

<txp:page_url type="css" />

Last edited by Gocom (2012-01-24 11:05:48)

Offline

Board footer

Powered by FluxBB