Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

  1. Index
  2. » Plugin support
  3. » rvm_css (v1.2)

#76 2008-12-20 01:03:35

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

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.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#77 2008-12-20 07:40:56

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

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

#78 2008-12-20 10:02:29

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

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

#79 2008-12-20 10:21:13

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

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

#80 2008-12-20 10:39:06

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

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

#81 2008-12-20 21:48:33

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

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

#82 2009-01-06 12:47:26

quemultimedia
Member
From: Nairobi
Registered: 2008-12-31
Posts: 42
Website

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

#84 2009-01-07 05:26:52

quemultimedia
Member
From: Nairobi
Registered: 2008-12-31
Posts: 42
Website

Re: rvm_css (v1.2)

Thanks Els,

Now working perfectly.


Que,
Que-Multimedia

Offline

#85 2009-01-07 11:18:03

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

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

#87 2009-02-03 16:10:02

JanDW
Plugin Author
From: Providence, RI, USA
Registered: 2008-07-18
Posts: 327
Website

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.

You could also have a look at the tag trace to see what happens.

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

#88 2009-02-06 17:14:31

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

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

  1. Index
  2. » Plugin support
  3. » rvm_css (v1.2)

Board footer

Powered by FluxBB