Summary: Talk page for CSSInWikiPages.
Users: (View? / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.

No matter how I configure the stylepage.php file and the (:stylepage:) code, the pop-up (mouse-over text) will only load from the Site.StyleSheet page. I tried using the SiteGroup category, and adjusting the permissions, but it's a simple on-again, off-again thing when I change the second line of the cookbook php code.

SDV($EnableStylePage, 1);
SDV($DefaultStylePage, 'Site.StyleSheet');
SDV($DefaultStyleGroup, $Site);
SDV($EnableDefaultGroupStylesOnly, 0);
SDV($PubCacheDir, "pub/cache");
SDV($PubCacheUrl, "$PubDirUrl/cache");
SDV($StylePageCacheDir, $PubCacheDir);
SDV($StylePageCacheUrl, $PubCacheUrl);

This above works; none other. I suspect that a cacheing defect may be occurring serverside. Any help?


Here's an alternative markup that's a bit more concise & robust and doesn't need to be surrounded in a >>comment<<:

Markup('css', '<[=',
    "PZZ(NoCache( \$GLOBALS['HTMLStylesFmt'][] = PSS('$1') ))" );

What's different here is that the tags surrounding the CSS are (:css:) and (:cssend:), the NoCache disables the HTML caching which would otherwise break as we're adding stuff to the page header, and PZZ ensures that the CSS isn't shown in the page contents. On a separate note, since we're extracting the CSS in the middle of the wikimarkup conversion, this simple way won't get rid of the <:vspace> that are inserted in the resulting CSS for each blank line. --EemeliAro December 21, 2007, at 04:32 PM

The above markup doesn't work for me. But this does:
Markup_e('css', '<[=',
    "PZZ(NoCache(\$GLOBALS['HTMLStylesFmt'][] = \$m[1]))" );
Said Achmiz August 18, 2017, at 07:36 PM

Could working examples be given on the markup options please? I have tried in the sandbox, but couldn't make it work. I try to use stylesheet markup with table cells.

Try this on a page. If it does not work check your page's HTML source. The style should have been added in the <style> section underneath <!--HTMLHeader--> (~HansB)

#wikitext table td {color:red; background:yellow; }

I haven't been able to get the wiki engine to actually apply the stylesheet using the markup method yet. As for the link in the template, that worked in IE but not Firefox, which (probably for security reasons) didn't let me apply the CSS to the page prior to viewing it, apparently(?). It seems like there must be a better way to incorporate the text of a wiki page directly without having to browse to the page and use the page action. How could we do that? Can the engine apply something directly from the unmarked-up text of a wiki page before rendering the page? -- JonHaupt

The issue with Firefox is that it looks at the Content-type: header of a result to decide if it's a valid CSS page or not. PmWiki's ?action=source returns the source as "text/plain" (and not "text/css"), so Firefox ignores it. --Pm

I fixed the markup problem (missing colon). Now the markup works, except that the text inside (:stylesheet:)...(:stylesheetend:) ends up being included in a page. (fixed with comment markup - thanks HansB) -- JonHaupt

$EnableStylePage = 1; should be put before include_once("$FarmD/cookbook/stylepage.php"); to make the global include work. Thanks for this fine recipe just what I was looking for :-) Bart August 17, 2006, at 05:38 AM

Note, if you can't get that to work (as I can't), you can enable the Site.AllGroupHeader and add the (:stylepage:) there to enable the CSSInWikiPages for the entire site.Pico August 27, 2006, at 02:17 PM
The $EnableStylePage = 1; isn't going to work in most cases as the IF statement if ($EnableStylePage == 1) { LoadStylePage($DefaultStylePage); } is contained within the function itself and therefore will only be encountered on a page in which the function gets called anyway. How could this problem be fixed? - JonHaupt
I fixed this now, and improved the caching routine, as it failed sometime to cache a file. HansB August 29, 2006, at 04:31 AM

This is so cool. But I'm having trouble tring to use a style in PageTopMenu on your skins (FixFlow). All works fine when I'm on that page, but on other pages, the text from PageTopMenu appears without the style included. I tried placing the enable line in config.php, and the style directive in Site.AllGroupHeader, but nothing works for this particular use. Pico August 26, 2006, at 09:23 PM

What css styling are you trying to use? HansB
List styling. I've been trying out different navigational menu systems. Specifically, the CSS I am using to test this out is located here http://exploding-boy.com/images/cssmenus/menus.html (I downloaded the gifs to the pub/cache). On the PageTopMenu I am using
(:div1 id=tabsF:)
As I mentioned, it works fine when I am on that page: it displays namvigational menu above the #tabnav .lnav and .rnav frim FixFlow, but on other pages, the list is unstyled. Pico August 27, 2006, at 07:46 AM
Put markup (:stylepage Site.FixflowStyle:) on Site.AllGroupHeader, not Site.PageTopMenu. You still may get some interference from .nav class styling and also colors from a color css file at #topnav hover. The whole PageTopMenu is in a div topmenu with class .nav. If you just want those image tabs it may be better to edit the fixflow template as well.
Yes AllGroupHeader works. Note to others who read this: See AllGroupHeader for instructions on enabling it in config.php.

To open up the PageTopMenu for other menu systems it may be best to do the following:

  • In the skin template remove class='nav' from div id='topnav'
  • In color css files change #topnav li a:hover and #topnav li a:active to #topnav .nav li a:hover and #topnav .nav li a:active
  • In PageTopMenu, if you want to use the standard pipe style menu, put the li items in >>rnav nav<< or >>lnav nav<< divs.
  • If you want to use img tabs put the li items in a >>tabs<< div, and use %tabs%link word%% inside each link. corrected!!
For me, I have to use div directives: (:div id=tabs:) and [[SomePage|%tabs%Link text%%]]. I can't get >>tabs<< to work (and it doesn't matter what I call the style (%tabsnot%Link text%%) because I just need a span for many cool approaches, e.g. pure css popups(offsite) Pico August 27, 2006, at 06:41 PM

I quite like those tabs and may facilitate easier adaption in the above manner in a future skin release. HansB

Thanks for the help and responsiveness. Pico August 27, 2006, at 01:39 PM

I find that using this recipe and AuthUser causes me to have to login 2 times. If I comment this out include_once("$FarmD/cookbook/stylepage.php"); then I can just login one time. What could be causing this? Where should the include be placed in reference to AuthUser ? GNUZoo March 27, 2007

It seems like it's probably asking you to login because the stylesheet page might not be read-accessible without a login. I think I have it after authuser in mine. You might want to make sure the stylesheet page is read-accessible though. - JonHaupt

Talk page for the CSSInWikiPages recipe (users?).