|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
freephile Smarty n00b
Joined: 26 Jun 2003 Posts: 2 Location: Newburyport, MA
|
Posted: Thu Jun 26, 2003 1:49 pm Post subject: Using global PHP variable within included PHP file in tpl |
|
|
I have a header.tpl file that defines all the opening code for my pages, including the entire <head> section. In that template is a include_php statement to include a php file which in turn uses global PHP variables. The problem is that the included PHP file in the tpl file seems not to have access to the global PHP scope because no values are substituted.
I can't convert these PHP variables to template vars because the PHP file in question is actually a dynamically generated CSS file. In this file (style.php) all my CSS rules are dynamically selected according to the value of a cookie.
Is there something I'm missing on how to make php includes work with global PHP variables?
Or, do I have to completely change my dynamic CSS system to fit with Smarty? Most projects I've seen seem to use static CSS files that get selected by a switch, rather than using a dynamic CSS file. I obviously like the latter approach.
Eg.
{* Smarty template *}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<head>
<title>{$page.title}</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"></meta>
<meta http-equiv="Content-Language" content="EN"></meta>
{$page.metaTags.description}
{$page.metaTags.keywords}
<meta name="robot" content="index,follow"></meta>
<meta name="copyright" content="Copyright © 2003 Knowledge Institute. All Rights Reserved."></meta>
<meta name="author" content="FREePHILE, We Are 'Open' For Business - http://www.freephile.com"></meta>
<meta name="generator" content="Quanta Plus - free editor for Linux"></meta>
<meta name="Revisit-After" content="30 days"></meta>
<meta name="MSSmartTagsPreventParsing" content="TRUE"></meta>
{include_php file="/web/dev.buzgate.org/public_html/styles/defaultStyle.php"}
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"></link>
**********************************************************************************************
Excerpt from CSS file:
BODY, TABLE, TD {
font-family:verdana,arial,helvetica;
font-size:12px;
color:<?php echo $_bm['colors']['black']; ?>;
background-color:transparent;
margin:0px;
padding:0px;
/*for easy debugging, turn on*/
border:0px solid green;
scrollbar-face-color: <?php echo $_bm['colors']['midnight']; ?>;
scrollbar-highlight-color: <?php echo $_bm['colors']['morning']; ?>;
scrollbar-3dlight-color: <?php echo $_bm['colors']['morning']; ?>;
scrollbar-darkshadow-color: #000000;
scrollbar-shadow-color: <?php echo $_bm['colors']['dusk']; ?>;
scrollbar-arrow-color: <?php echo $_bm['colors']['night']; ?>;
scrollbar-track-color: <?php echo $_bm['colors']['dusk']; ?>;
}
Thanks,
Greg
Last edited by freephile on Wed May 05, 2010 10:59 pm; edited 1 time in total |
|
Back to top |
|
freephile Smarty n00b
Joined: 26 Jun 2003 Posts: 2 Location: Newburyport, MA
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|