Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: rvm_css (v1.2)
Bug!
When creating a new stylesheet, the content of the textarea seems to be saved on the database, but the served static file is just a copy of the default CSS (more precisely, of the stylesheet being used by the default section, that may not necessary be the one with name default).
Steps to reproduce it:
1. create a new stylesheet using the “Create or load a new style”
2. add your rules, paste your stylesheet, whatever…
3. Save it.
You will see your stylesheet on the textarea, but if you check the corresponding file, it has the rules for your default CSS.
I’m on Txp 4.0.7.
Offline
Re: rvm_css (v1.2)
Thanks. If you edit the plugin, you can replace this line:
[incomplete/incorrect fix removed. New plugin version is available]
Last edited by ruud (2008-12-20 21:49:23)
Offline
Re: rvm_css (v1.2)
Does this require a plug-in update Ruud, or should we all just do the above mod, or is it an individual problem that Julián is suffering from?
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
Re: rvm_css (v1.2)
I’ll update the plugin tonight (at work right now). This problem only occurs if you create a new style sheet or if you copy a style sheet. Updating stylesheets works fine.
Offline
Re: rvm_css (v1.2)
Working on a Saturday Ruud? Deary me! ;)
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
Re: rvm_css (v1.2)
Version 0.4 of rvm_css is now available.
NOTE: those that used my earlier fix should upgrade as well, because the fix was incomplete and will cause problems if you use style sheet names which translate to a different filename.
Offline
Re: rvm_css (v1.2)
having problems with my css….
on the default page, everything shows proper, but when I move to sections, or individual articles, then I loose all the CSS formating of the page,
Currently using different ‘page’ codes for the different sections, with the css files ‘hard-linked’ in the head section of the page, which is cumbersome, would like to use just a single, or two ‘pages’ for the install, and link properly to the CSS.
Any ideas?
Que,
Que-Multimedia
Offline
#83 2009-01-06 14:38:57
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: rvm_css (v1.2)
How are you linking to the css at the moment? Use something like this:
href="<txp:site_url />name-of-css-folder/your.css"
Last edited by els (2009-01-06 14:39:32)
Offline
Re: rvm_css (v1.2)
Thanks Els,
Now working perfectly.
Que,
Que-Multimedia
Offline
Re: rvm_css (v1.2)
Or use the <txp:rvm_css /> tag, which should work (otherwise it’s a bug).
_
Offline
#86 2009-02-03 12:10:29
- isellsoap
- New Member
- Registered: 2009-02-03
- Posts: 2
Re: rvm_css (v1.2)
I have a strange problem.
My CSS implementation: <style type=“text/css”>@import url(“<txp:rvm_css />”);</style>
This works fine for the frontpage and for all section pages but when I go to a single article it displays the site as if there isn’t any css file. When I look into the page source code the CSS implementation is there, so normally there shouldn’t be any problem. Can someone help me on this?
Last edited by isellsoap (2009-02-03 12:11:38)
Offline
Re: rvm_css (v1.2)
you could use <txp:rvm_css n="name_of_styles" /> . The disadvantage would be that you can’t hook up a new stylesheet easily under the sections tab.
Last edited by JanDW (2009-02-03 16:12:12)
TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX
Offline
Re: rvm_css (v1.2)
isellsoap wrote:
My CSS implementation: <style type=“text/css”>@import url(“<txp:rvm_css />”);</style>
This works fine for the frontpage and for all section pages but when I go to a single article it displays the site as if there isn’t any css file. When I look into the page source code the CSS implementation is there, so normally there shouldn’t be any problem. Can someone help me on this?
So the URL that rvm_css inserts in the HTML code is correct? In that case it’s not a plugin problem.
Offline
#89 2009-03-04 02:48:13
- johnnie
- Member
- Registered: 2007-03-10
- Posts: 58
Re: rvm_css (v1.2)
Ruud, I have an idea. See this as a feature request:
To further speed up CSS serving, would it be possible to add some simple minification to the locally stored css file? e.g. removing newlines, removing comments etc. It should all be possible using some regular expresions. That way CSS would still be editable in a nice manner, but the actually served version is a lot smaller! See http://www.refresh-sf.com/yui/ for an example CSS minifier.
Offline
#90 2009-03-04 03:50:29
- johnnie
- Member
- Registered: 2007-03-10
- Posts: 58
Re: rvm_css (v1.2)
There, I’ve done the work for you. Replace the rvm_css_save() function with this to get minified CSS stored to the server (not the DB, so you can still edit the easily workable ‘beautiful’ version of your CSS!). On larger CSS files, the savings can be quite good! Ofcourse you might want to add an option for this or something like that, but here’s the code for it:
function rvm_css_save()
{
global $path_to_site, $rvm_css_dir;
$name = (ps('copy') or ps('savenew')) ? ps('newname') : ps('name');
$filename = strtolower(sanitizeForUrl($name));
if (empty($rvm_css_dir) or !$filename)
{
return;
}
$css = safe_field('css', 'txp_css', "name='".doSlash($name)."'");
if ($css)
{
$minicss = base64_decode($css);
$minicss = preg_replace("/\r\n/","",$minicss);
$minicss = preg_replace("/:(\s*|\t*)/",":",$minicss);
$minicss = preg_replace("/;(\s*|\t*)/",";",$minicss);
$minicss = preg_replace("/,\s*/",",",$minicss);
$minicss = preg_replace("/(\s*|\t*){/","{",$minicss);
$minicss = preg_replace("/}(\s*|\t*)/","}",$minicss);
$minicss = preg_replace("/\/\*(.*?)\*\//","",$minicss);
$file = $path_to_site.'/'.$rvm_css_dir.'/'.$filename.'.css';
$handle = fopen($file, 'wb');
fwrite($handle, $minicss);
fclose($handle);
}
}
Last edited by johnnie (2009-03-04 03:51:45)
Offline