Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2008-01-02 11:06:03

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: rvm_css (v1.2)

I actually use two forms – “header” and “header_error” – first one for normal pages and the second one goes in error_default page.

In the header form:

<!-- CSS -->
<txp:rvm_css format="link" n="default" />
<txp:rvm_css format="link" n="menu" />

Produces:

<!-- CSS -->
<link rel="stylesheet" type="text/css" media="screen" href="http://www.mysite.com/css/default.css" />
<link rel="stylesheet" type="text/css" media="screen" href="http://www.mysite.com/css/menu.css" />

With the same rvm_css tags in the header_error form, I get this:

<!-- CSS -->
<link rel="stylesheet" type="text/css" media="screen" href="http://www.mysite.com/css/default.css" />
<link rel="stylesheet" type="text/css" media="screen" href="http://www.mysite.com/css/default.css" />

Its picking up the default.css but not the menu.css.

Offline

#14 2008-01-02 18:43:16

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: rvm_css (v1.2)

Neil and Jonathan, try version 0.3 of the plugin (see first post). That should fix both problems.

As for stm_javascript… it’s probably best to ask that plugin author to add this functionality, which would be more efficient (in code size) than creating an companion plugin for stm_javascript.

Offline

#15 2008-01-02 20:27:33

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,595
GitHub Twitter

Re: rvm_css (v1.2)

Just one word : fabulousssssssssssssssssssssss!

;p

Have a very good new year Ruud.

:)


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#16 2008-01-02 20:46:28

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: rvm_css (v1.2)

Fixed. Thanks Ruud.

Offline

#17 2008-01-02 20:49:59

zero
Member
From: Lancashire
Registered: 2004-04-19
Posts: 1,470
Website

Re: rvm_css (v1.2)

Would this be worthwhile if using a php styleswitcher? I have this code in the head of the page. I can change txp:css but how would I alter the other code and would it be any good anyway?

<style type="text/css" media="screen,projection">
@import "<txp:site_url />textpattern/css.php?n=default";
</style>
<txp:php>
global $prefs;
$cookie_s1 = cs('s1');
$cookie_s2 = cs('s2')
;
if ($cookie_s2) {
echo n.'<link rel="stylesheet" type="text/css" media="screen,projection" href="'.hu.'textpattern/css.php?n='.$cookie_s2.'" />';
}
if ($cookie_s1) {
echo n.'<link rel="stylesheet" type="text/css" media="screen,projection" href="'.hu.'textpattern/css.php?n='.$cookie_s1.'" title="'.$cookie_s1.'" />';
}
</txp:php>
<txp:css format="link" rel="alternate stylesheet" media="screen,projection" n="c" title="cool" />
<txp:css format="link" rel="alternate stylesheet" media="screen,projection" n="w" title="warm" /> 
etcetera

BB6 Band My band
Gud One My blog

Offline

#18 2008-01-02 21:14:41

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: rvm_css (v1.2)

peter, you’re loading 3 – 5 style sheets so rvm_css would give a huge speed increase (saves 3 – 5 times the overhead of starting PHP and TXP to get a style sheet). The fact that your template contains a PHP style switcher doesn’t matter. It’s not the switching part that benefits, but the speed of loading the individual stylesheets:

@import "<txp:rvm_css n="default" />";

and replace <txp:css with <txp:rvm_css in all other places (see plugin help for other steps required after installation).

Offline

#19 2008-01-02 22:32:55

zero
Member
From: Lancashire
Registered: 2004-04-19
Posts: 1,470
Website

Re: rvm_css (v1.2)

Brilliant! Thank you, Ruud! It’s all working great!


BB6 Band My band
Gud One My blog

Offline

#20 2008-01-03 13:30:38

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: rvm_css (v1.2)

Ruud

thank you for yet another useful plugin.

Quick question: should plugins or mods assume the directory separator character is ‘/’ or should they use the DS definition of a directory separator as defined in constants.php? AFAIK, Windows uses ‘\’ as its path separator.

I’d like to know because I do use the ‘DS’ definition for directory separators in some of my own plugins and just wondered what the developers take on it is.

In fact, is the ‘DS’ is even needed at all (ie can Windows survive a ‘/’ separated file path without choking.)?

Many thanks in advance,


Steve

Offline

#21 2008-01-03 14:28:46

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: rvm_css (v1.2)

As I understand it, windows accepts both / and \ (but I can’t test in windows)
In TXP sometimes DS is used, sometimes a hardcoded / is used.

Offline

#22 2008-01-03 14:34:53

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: rvm_css (v1.2)

Ruud

As I understand it, windows accepts both / and \ (but I can’t test in windows)

Thank you.


Steve

Offline

#23 2008-01-03 15:32:44

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,323
Website Mastodon

Re: rvm_css (v1.2)

Yes, Windows accepts both characters as an input path delimiter, but you should be extra careful if you process directory paths which were read as an OS output. It depends on the consistent use of DS in both path building and path processing code whether your code works cross platform.

Case in point is for instance here which didn’t work in Windows in its previous incarnation with hardcoded directory separators.

Offline

#24 2008-01-03 15:47:08

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: rvm_css (v1.2)

Ruud, Wet

Thank you both for answering my questions. I’ll be sticking with using the DS definition after reading your posts.

Ruud

Sorry if this seems to be hijacking your plugin thread but my question was honestly triggered by your code. I think in future I’ll start a new thread for any similar issues arising.


Steve

Offline

Board footer

Powered by FluxBB