I will change the background color of some table th. In my example here I used a <div>.
I have a script, which seperate 2 different printing outputs in a css tab design, so it is the same website, if you change the tabs.
I want to use for every tab different backround-colors.
I have tried to add a new php variable into one class in my print.php file like `
<class="tab_new '.$css_class.'">
which should only have a css rule only for the backround color.
$css_class = 'classname1' // first case
$css_class = 'classname2' // second case
I will get the error PHP var $css_class is undefinied. But the problem is, that my print.php is requiering_once before the file, where the definition of $css_class is (verb.php).
Please have a look at this 2 files. Maybe my example here isn't correct for my question, but I don't know, how to explain it otherwise.
.blue {background-color:CornflowerBlue; font-weight:bold}
<div class="blue">My backround is CornflowerBlue</div>
<br><br>
<div class="blue">My backround should be green</div>
$css_classin print.php anywhere, but it looks like your problem is your functions. It looks like you are trying to reference a variable in global space from inside your function. Try addingglobal $css_class;to the top of the function. php.net/manual/en/language.variables.scope.phpcss_classto the github version, because it wouldn't worked anyway. I have tried to useglobal $css_classand it worked. I have updated the files on github. Is this the best solution?