Re: [pmwiki-users] Using variable in skin template

2009-10-24 Thread Hans
Friday, October 23, 2009, 11:14:24 PM, Sandy wrote:

 Thinking further, can this go in skin.php?
 $color1 = '#00cc00';
 That keeps all the skin stuff in the skin, and avoids $HTMLStylesFmt[].

why don't you just set the color attributes in
the skin's css file? after all, the purpose of the
css file is to have one location for changing atributes
site-wide. There is realy no need to set a color attribute
via a php variable, unles one wants to dynamically
manipulate it, say by using value sset in a wiki page.


  ~Hans


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using variable in skin template

2009-10-24 Thread Hans
Saturday, October 24, 2009, 3:54:43 AM, DaveG wrote:

 Sandy wrote:
 I'm not (yet) comfortable with $HTMLStylesFmt[]. 
 It's an array, which can contain arrays :) 

I thought not. I understand $HTMLStylesFmt to list
css attributes, which get injected into
styles.../styles tags in the page's HTML
 head section (to put it briefly).

So an admin or developer can use

$HTMLStylesFmt[] = some HTML selectors with css attributes;

to add these attributes to the $HTMLStylesFmt array
and thus inject them into the styles tags.
It just means adding a new element to the array.
If you give it a name, like $HTMLStylesFmt['mycss'],
then it will be added to the array with that key name,
instead of a numerical key. This is useful for situations
where otherwise it may be added several times with the same css
atributes, to avoid such repetitions. I used that in markup
functions, where the same markup may be used several times in
a page.

  ~Hans


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using variable in skin template

2009-10-24 Thread Hans
Friday, October 23, 2009, 11:56:25 PM, DaveG wrote:

 Parse error: syntax error, unexpected T_STRING in
 /path/pmwiki.php(762) : eval()'d code on line 1
 That's because the PageVar needed to be quoted, as Hans showed. Thus,
 $FmtPV['$myvar'] = 'PageVar($pagename,\'$:myvar\')'

There were in fact several things wrong with your code:

1. missing quotes
2. wrong function: PageTextVar() is used to exctract a PTV
3. use of $pagename: use $pn rather than $pagename as $ pagename may
   have a different value.
4. PTV name: if the PTV is named in the page 'myvar', then
   that should be used a parameter in the PageTextVar() call.
   PageVar($pn, myvar)
   {$:myvar} is the syntax to refer to th ePTV in a wiki page.


  ~Hans


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using variable in skin template

2009-10-24 Thread DaveG


Hans wrote:
 Friday, October 23, 2009, 11:56:25 PM, DaveG wrote:
 
 Parse error: syntax error, unexpected T_STRING in
 /path/pmwiki.php(762) : eval()'d code on line 1
 That's because the PageVar needed to be quoted, as Hans showed. Thus,
 $FmtPV['$myvar'] = 'PageVar($pagename,\'$:myvar\')'
 
 There were in fact several things wrong with your code:
 
 1. missing quotes
Yep.

 2. wrong function: PageTextVar() is used to exctract a PTV
Actually, either function works, as PageVar calls PageTextVar. It is 
probably mildly faster to call PageTextVar directly though.


 3. use of $pagename: use $pn rather than $pagename as $ pagename may
have a different value.
Not sure about this. Is $pn globally available? Not sure, but it doesn't 
look like it. I'd always thought $pagename referred to the current page 
from within skin/config files.


 4. PTV name: if the PTV is named in the page 'myvar', then
that should be used a parameter in the PageTextVar() call.
PageVar($pn, myvar)
{$:myvar} is the syntax to refer to th ePTV in a wiki page.
That's correct when calling PageTextVar. But called from PageVar, then 
the $:myvar format is used.


  ~ ~ David

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using variable in skin template

2009-10-24 Thread Sandy
DaveG wrote:
 Sandy wrote:
 I'm not (yet) comfortable with $HTMLStylesFmt[]. 
 It's an array, which can contain arrays :) Usually you index the array 
 with the name of the skin, but any name (or even no name) will work 
 fine. The content of the array is output at the point in the .tmpl file 
 where the !--HTMLHeader-- tag appears.

That makes sense. The more I look beneath the hood, the more I'm 
impressed with how well things are laid out. No $500 labour bills to 
reach one faulty wire.

 For that matter, arrays 
 in php still confuse me. Perfectly clear while I'm reading the 
 tutorials,... A matter of practice.

 Easiest way to learn is to print the content of the array. it's not 
 clean and might cause some errors, so only do this on a dev environment, 
 but simply add this to a skin.php file:
print_r($HTMLStylesFmt);
 
 Then view the source of the web page to see the content of the array.

Good idea. I remember doing that in a tutorial, way back when. (I'm a 
binge user. A week or two intense, then forget everything over the next 
six months.) Doesn't help that I've dabbled in 6 very different 
languages over the last 25 years. Let me count the different print 
formats,...


 Thinking further, can this go in skin.php?
 $color1 = '#00cc00';
 That keeps all the skin stuff in the skin, and avoids $HTMLStylesFmt[].
 Well in order to use the variable from within the template you'd need 
 use $FmtPV:
$FmtPV['$color1']='#00cc00';
 
 So then you could use it in .tmpl (not in .css files though). Personally 
 I prefer to use $HTMLStylesFmt.


What's up with the two quotation marks? I remember something about  not 
being the same as ', something about one being literal and the other 
interpretting the variable names, but google is being dense.

Sandy






___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using variable in skin template

2009-10-24 Thread Hans
Saturday, October 24, 2009, 4:04:34 PM, DaveG wrote:

 3. use of $pagename: use $pn rather than $pagename as $ pagename may
have a different value.
 Not sure about this. Is $pn globally available? Not sure, but it doesn't
 look like it. I'd always thought $pagename referred to the current page
 from within skin/config files.

If you use $pagename in a $FmtPV[...] setting,
it will use whatever the value of $pagename is at that point
in config.php. This may be what you need, but it may also be
different, depending on what page the page variable markup
is encountered, and how $EnableRelativePageVars is set.

If you use $pn, then it will only be filled when the $FmtPV item is
evaluated, and will be correct as for that circumstance.

You can see in pmwiki.php that the $FmtPV items use $pn throughout.


  ~Hans


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using variable in skin template

2009-10-24 Thread Sandy
Hans wrote:
 Friday, October 23, 2009, 11:14:24 PM, Sandy wrote:
 
 Thinking further, can this go in skin.php?
 $color1 = '#00cc00';
 That keeps all the skin stuff in the skin, and avoids $HTMLStylesFmt[].
 
 why don't you just set the color attributes in
 the skin's css file? after all, the purpose of the
 css file is to have one location for changing atributes
 site-wide. There is realy no need to set a color attribute
 via a php variable, unles one wants to dynamically
 manipulate it, say by using value sset in a wiki page.
 
 
   ~Hans

The current site uses only one set of colours, so it's easier to keep 
them in the style tag and only deal with one file. I've used separate 
css files before, but it's overkill for this one.

The reason I want a variable is if I use #006600 for several different 
elements (H#, A, HR, various borders) then want to try #007700, I have 
to change each and every occurence. Yes, I can use the editor's 
search-and-replace, but a variable seems more elegant. Separating it 
into a separate css file wouldn't change that.

I could do the style as
H1, H2, ... A.hover
{color:#006600;}

so the color number occurs only once, but I suspect there's a reason 
I've never seen a file done that way.

Now to stop chatting and start experimenting.

Thanks,

Sandy


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using variable in skin template

2009-10-24 Thread DaveG


Sandy wrote:
 Well in order to use the variable from within the template you'd need 
 use $FmtPV:
$FmtPV['$color1']='#00cc00';

 So then you could use it in .tmpl (not in .css files though). Personally 
 I prefer to use $HTMLStylesFmt.
 
 
 What's up with the two quotation marks? I remember something about  not 
 being the same as ', something about one being literal and the other 
 interpretting the variable names, but google is being dense.
Because anything assigned to $FmtPV needs to be executable. Refer to 
PmWiki/PageVariables.

  ~ ~ Dave

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using variable in skin template

2009-10-24 Thread Sandy
DaveG wrote:
 
 Sandy wrote:
 Well in order to use the variable from within the template you'd need 
 use $FmtPV:
$FmtPV['$color1']='#00cc00';

 So then you could use it in .tmpl (not in .css files though). Personally 
 I prefer to use $HTMLStylesFmt.

 What's up with the two quotation marks? I remember something about  not 
 being the same as ', something about one being literal and the other 
 interpretting the variable names, but google is being dense.
 Because anything assigned to $FmtPV needs to be executable. Refer to 
 PmWiki/PageVariables.
 
   ~ ~ Dave

Experiments done for now. Several things work in group.php but not 
testskin.php.

I'd like to start with all the skin code in the skin folder so it can 
easily be moved between farms. Further customizing can then be done in 
either php file, depending on the setup of the new farm.

Result of experiments: Very confused, especially the last result. Must 
learn more about skin.php files and experiment more, and re-read the php 
tutorials. Trying to learn too many things at once.

Thanks for the help.

Sandy



Results of experiments:
-
$color1 = '#00cc00';
$HTMLStylesFmt['my_skin'] = h1 {color:$color1;} ;

works in the group.php, but not in testskin.php .

-
in group.php:
$FmtPV['$color1']='#00cc00';
then in .tmpl
style
h1 {color:$color1;}
/style

works.


Same thing in testskin.php gives this html:
h1 {color:gold1;}

Suspect $FmtPV['$color1'] is being over-ridden by a recipe. No clue 
which one.


Try testskin.php again, with different variable name. Resulting .html is:
h1 {color:$Sandy1;}

One has $ and one doesn't. Probably means something to someone who 
finished the php tutorials.

--- -
add to each php file:
print_r($HTMLStylesFmt);
Works in group.php. Doesn't work in testskin.php.


add line of garbage to testskin.php

yes, the file is being called.


in group.php:
$FmtPV['$sandy1']='#00cc00';
in testskin.tmpl
style
h1 {color:$FmtPV['$sandy1'];}
/style
Resulting html:
h1 {color:$FmtPV['#00cc00'];}
Rechecked that one with different variable names three times. Offically 
confused.










___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using variable in skin template

2009-10-24 Thread Sandy
Aha! Googling the right terms helps. A way to use php to create a css file.

http://www.barelyfitz.com/projects/csscolor/

Probably old news to many, but new and intriguing to me. Just checked 
the PmWiki docs, and yes I can have more than one php file in the skin 
folder. Something for me to play with next weekend.

Sandy

Key lines:

+

To use PHP in your CSS file:

1. Rename your style.css file to style.php, then add the following to 
the top of the file:

   ?php header(Content-type: text/css); ?

This line tells the browser that the file is CSS instead of HTML.

2. In your HTML files, change the stylesheet references from style.css 
to style.php. For example:

   link rel=stylesheet type=text/css
media=screen ref=style.php

++




___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using variable in skin template

2009-10-24 Thread DaveG


Sandy wrote:
 Aha! Googling the right terms helps. A way to use php to create a css file.
 
 http://www.barelyfitz.com/projects/csscolor/
You could do this, but I can't help thinking you're way over 
complicating things...


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using variable in skin template

2009-10-23 Thread DaveG


Sven Hartenstein wrote:
 Dear pmwiki-users,
 
 I have a lot of fun discovering pmwiki and I already like it very
 much.
 
 One thing I can't figure out, even after reading many pages on
 pmwiki.org:
 
 I would like to use a variable in my skin template. Ideally, this
 would be similar to the
 
   (:title Title of Page:)
 
 markup, but I'd be ok with using a PageTextVariable. So, is it
 possible to use such a variable in the skin template? {*$:MyVariable}
 does not seem to work. (It does work in the SideBar or in a
 GroupHeader, but not within the skin template.)
To use a PHP variable within a skin template you need to store it as a 
FmtPV variable, which needs to be a executable PHP statement (thus the 
odd quotes). Refer to PmWiki/PageVariables:
$FmtPV['$MyVar'] = 'abc';

And then to use it in the .tmpl file:
   My quote of the day is {$MyVar}

 In case it helps to know what I want this for: I'd like to print some
 quote on each page in the very top of the page. I could use a
 WikiStyle with absolute positioning CSS, but I imagine using a
 variable within the templage (just like {$Title}) would be more
 elegant.
 
 (Or is the standard way to use a GroupHeader? I tried this but the
 content of the GroupHeader is shown at the top of the page content,
 not within the skin's HTML.)
You might be better off doing this in the GroupHeader -- that will 
provide a little more flexibility if you decide that some pages don't 
need a quote.

So, just edit the group header from within PmWiki and add the FmtPV you 
declared:
   Here's my variable {$MyVar}


  ~ ~ Dave

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using variable in skin template

2009-10-23 Thread Sven Hartenstein
Hi Dave,

thank you for your answer!

 I would like to use a variable in my skin template. Ideally, this
 would be similar to the

   (:title Title of Page:)

 markup, but I'd be ok with using a PageTextVariable. So, is it
 possible to use such a variable in the skin template? {*$:MyVariable}
 does not seem to work. (It does work in the SideBar or in a
 GroupHeader, but not within the skin template.)
 To use a PHP variable within a skin template you need to store it as a  
 FmtPV variable, which needs to be a executable PHP statement (thus the  
 odd quotes). Refer to PmWiki/PageVariables:
 $FmtPV['$MyVar'] = 'abc';

But this would mean the variable has just one value. I would like the
wiki editors to be able to set the variable differently for each page,
when editing the page.

Any solution for this?

Sven

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using variable in skin template

2009-10-23 Thread Sandy
DaveG wrote:
 
 To use a PHP variable within a skin template you need to store it as a 
 FmtPV variable, which needs to be a executable PHP statement (thus the 
 odd quotes). Refer to PmWiki/PageVariables:
 $FmtPV['$MyVar'] = 'abc';
 
 And then to use it in the .tmpl file:
My quote of the day is {$MyVar}
 


Could you also do:

in config.php
$FmtPV['$color1'] = '#00cc00';


then in the .tmpl file:
style
h1 {color:$color1;}
A {color:$color1;}

then when the client changes his mind, I only have to change it once.

Happy!

Sandy


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using variable in skin template

2009-10-23 Thread Hans
Friday, October 23, 2009, 8:14:27 PM, Sven Hartenstein wrote:

 But this would mean the variable has just one value. I would like the
 wiki editors to be able to set the variable differently for each page,
 when editing the page.

Then maybe it is easiest to use  div markup for those quotes, with a
specific class name, and use css to set the div where you want it.
But you would need to absolutely position it.
for instance
in page content:

topquote
here is a quote..


in pub/css/local.css:

.topquote {
  position:absolute;
  top:10px; right:400px;
  width:300px;
  ..
}


  ~Hans


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using variable in skin template

2009-10-23 Thread Sven Hartenstein
Hi Hans,

 Then maybe it is easiest to use div markup for those quotes, with a
 specific class name, and use css to set the div where you want it.
 But you would need to absolutely position it.

That's what I currently do. I am not very happy with it. I would
prefer to set the text in the same table as the logo (i.e. in the
skin), so that the two areas do not overlap...

Any chance of using a PageTextVariable in the skin template?

Sven


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using variable in skin template

2009-10-23 Thread DaveG


Sandy wrote:
 in config.php
 $FmtPV['$color1'] = '#00cc00';
 
 
 then in the .tmpl file:
 style
 h1 {color:$color1;}
 A {color:$color1;}
Rather than this use:

   $color1 = '#00cc00';
   $HTMLStylesFmt['my_skin'] = h1 {color:$color1;} ;

That way, there's no need to mess with .tmpl.

  ~ ~ Dave

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using variable in skin template

2009-10-23 Thread DaveG


Sven Hartenstein wrote:
 Hi Hans,
 
 Then maybe it is easiest to use div markup for those quotes, with a
 specific class name, and use css to set the div where you want it.
 But you would need to absolutely position it.
 
 That's what I currently do. I am not very happy with it. I would
 prefer to set the text in the same table as the logo (i.e. in the
 skin), so that the two areas do not overlap...
 
 Any chance of using a PageTextVariable in the skin template?
How about just using the PTV from the GroupHeader? So user defines the 
PTV in the page body:
MyQuote:Here's my quote

Or hide it with:
(:MyQuote:Here's my quote:)

And in the group header:
 myquoteclass
My quote is {$:MyQuote}.
 

Style the myquoteclass as appropriate.


  ~ ~ David

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using variable in skin template

2009-10-23 Thread DaveG


Sven Hartenstein wrote:
 Hi Hans,
 
 Then maybe it is easiest to use div markup for those quotes, with a
 specific class name, and use css to set the div where you want it.
 But you would need to absolutely position it.
 
 That's what I currently do. I am not very happy with it. I would
 prefer to set the text in the same table as the logo (i.e. in the
 skin), so that the two areas do not overlap...
 
 Any chance of using a PageTextVariable in the skin template?
Or, you could grab the PTV into a variable, and then use it from the tmpl:
   $FmtPV['$myvar'] = PageVar($pagename,'$:myvar')

And then use the myvar as described earlier.

  ~ ~ David

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using variable in skin template

2009-10-23 Thread Hans
Friday, October 23, 2009, 10:12:41 PM, Sven Hartenstein wrote:

 Any chance of using a PageTextVariable in the skin template?

try this:
add to config.php:

$FmtPV['$HeaderQuote'] = 'PageTextVar($pn, HeaderQuote)';

then put the page variable {$HeaderQuote} in your skin template
somewhere.

and let your editors add to a page the PTV

(:HeaderQuote: quote text :)

cheers,
  ~Hans


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using variable in skin template

2009-10-23 Thread Sandy
DaveG wrote:
 
 Sandy wrote:
 in config.php
 $FmtPV['$color1'] = '#00cc00';


 then in the .tmpl file:
 style
 h1 {color:$color1;}
 A {color:$color1;}
 Rather than this use:
 
$color1 = '#00cc00';
$HTMLStylesFmt['my_skin'] = h1 {color:$color1;} ;
 
 That way, there's no need to mess with .tmpl.
 
   ~ ~ Dave


I'm not (yet) comfortable with $HTMLStylesFmt[]. For that matter, arrays 
in php still confuse me. Perfectly clear while I'm reading the 
tutorials,... A matter of practice.

Thinking further, can this go in skin.php?
$color1 = '#00cc00';
That keeps all the skin stuff in the skin, and avoids $HTMLStylesFmt[].


Sandy


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using variable in skin template

2009-10-23 Thread Hans
Friday, October 23, 2009, 10:12:41 PM, Sven Hartenstein wrote:

 Any chance of using a PageTextVariable in the skin template?

you can do it even without setting a PV.

just addd to your skin template somewhere:

!--markup:{$:HeaderQuote}--


  ~Hans


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using variable in skin template

2009-10-23 Thread Hans

more info about skins and skin templates:
http://www.pmwiki.org/wiki/Cookbook/SkinGuidelines


  ~Hans


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using variable in skin template

2009-10-23 Thread Sven Hartenstein
Hi David,

 Or, you could grab the PTV into a variable, and then use it from the tmpl:
   $FmtPV['$myvar'] = PageVar($pagename,'$:myvar')

This gives me:

Parse error: syntax error, unexpected T_STRING in
/path/pmwiki.php(762) : eval()'d code on line 1

Do not know what's wrong. Anyway, the solutions suggested by Hans
work.

Thank you for your help!

Sven


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using variable in skin template

2009-10-23 Thread Sven Hartenstein
This works perfectly! Thank you a lot! :-)

Sven


* Hans desi...@softflow.co.uk:
 Friday, October 23, 2009, 10:12:41 PM, Sven Hartenstein wrote:
 
  Any chance of using a PageTextVariable in the skin template?
 
 try this:
 add to config.php:
 
 $FmtPV['$HeaderQuote'] = 'PageTextVar($pn, HeaderQuote)';
 
 then put the page variable {$HeaderQuote} in your skin template
 somewhere.
 
 and let your editors add to a page the PTV
 
 (:HeaderQuote: quote text :)
 
 cheers,
   ~Hans

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using variable in skin template

2009-10-23 Thread Sven Hartenstein
And this works perfectly, too. :-)

Thank you!

Sven


* Hans desi...@softflow.co.uk:
 Friday, October 23, 2009, 10:12:41 PM, Sven Hartenstein wrote:
 
  Any chance of using a PageTextVariable in the skin template?
 
 you can do it even without setting a PV.
 
 just addd to your skin template somewhere:
 
 !--markup:{$:HeaderQuote}--
 
 
   ~Hans

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using variable in skin template

2009-10-23 Thread DaveG


Sven Hartenstein wrote:
 Hi David,
 
 Or, you could grab the PTV into a variable, and then use it from the tmpl:
   $FmtPV['$myvar'] = PageVar($pagename,'$:myvar')
 
 This gives me:
 
 Parse error: syntax error, unexpected T_STRING in
 /path/pmwiki.php(762) : eval()'d code on line 1
That's because the PageVar needed to be quoted, as Hans showed. Thus,
$FmtPV['$myvar'] = 'PageVar($pagename,\'$:myvar\')'



___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using variable in skin template

2009-10-23 Thread DaveG

Sandy wrote:
 I'm not (yet) comfortable with $HTMLStylesFmt[]. 
It's an array, which can contain arrays :) Usually you index the array 
with the name of the skin, but any name (or even no name) will work 
fine. The content of the array is output at the point in the .tmpl file 
where the !--HTMLHeader-- tag appears.

 For that matter, arrays 
 in php still confuse me. Perfectly clear while I'm reading the 
 tutorials,... A matter of practice.
Easiest way to learn is to print the content of the array. it's not 
clean and might cause some errors, so only do this on a dev environment, 
but simply add this to a skin.php file:
   print_r($HTMLStylesFmt);

Then view the source of the web page to see the content of the array.


 Thinking further, can this go in skin.php?
 $color1 = '#00cc00';
 That keeps all the skin stuff in the skin, and avoids $HTMLStylesFmt[].
Well in order to use the variable from within the template you'd need 
use $FmtPV:
   $FmtPV['$color1']='#00cc00';

So then you could use it in .tmpl (not in .css files though). Personally 
I prefer to use $HTMLStylesFmt.


  ~ ~ David

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users