f



Parsing .css files with php: Cons?

given: I know about @import and cascading styles, etc etc.

Is is cool to parse .css files with php?  Like I may want to include()
sections into an overall .css.  Or i may want to do like color:#<?php
echo $thecolor; ?>.  That kind of stuff.

I guess there might be a little more overhead, but what's a few .css
files within a whole cms like wordpress?  I'm just looking for gotchas
and unforseen problems.

thanks,
j
0
juglesh689 (16)
1/16/2012 9:36:11 PM
comp.lang.php 32646 articles. 0 followers. Post Follow

12 Replies
453 Views

Similar Articles

[PageSpeed] 38

On 1/16/2012 10:36 PM, J. Frank Parnell wrote:
> given: I know about @import and cascading styles, etc etc.
>
> Is is cool to parse .css files with php?  Like I may want to include()
> sections into an overall .css.  Or i may want to do like color:#<?php
> echo $thecolor; ?>.  That kind of stuff.
>
> I guess there might be a little more overhead, but what's a few .css
> files within a whole cms like wordpress?  I'm just looking for gotchas
> and unforseen problems.
>
> thanks,
> j

Hi,

It is possible, but I prefer making multiple stylesheets.
Make the included stylesheet conditional.
eg:

<?php
  $usedstylesheet = ($test?"mycss/ver_abc.css":"mycss/ver_123.css");
$>
<link type="text/css" rel="stylesheet" media="screen" charset="utf-8"
href="http://www.example.com/<?php echo $usedstylesheet; ?>">

That way you have no PHP defining your stylesheet. That will make 
webdesigners who have to modify it later happy. ;-)

Regards,
Erwin Moller


-- 
"That which can be asserted without evidence, can be dismissed without 
evidence."
-- Christopher Hitchens
0
1/17/2012 10:42:41 AM
El 16/01/2012 22:36, J. Frank Parnell escribi�/wrote:
> given: I know about @import and cascading styles, etc etc.
>
> Is is cool to parse .css files with php?  Like I may want to include()
> sections into an overall .css.  Or i may want to do like color:#<?php
> echo $thecolor; ?>.  That kind of stuff.
>
> I guess there might be a little more overhead, but what's a few .css
> files within a whole cms like wordpress?  I'm just looking for gotchas
> and unforseen problems.

You might be interested in one of the existing CSS preprocessors, such 
as SASS or LESS. It's basically the idea you are describing, except that:

- CSS is generated once (not for every request).
- The code is already written (and not necessarily in PHP).


-- 
-- http://alvaro.es - �lvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programaci�n web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
0
1/17/2012 12:31:17 PM
On Jan 16, 9:36=A0pm, "J. Frank Parnell" <jugl...@gmail.com> wrote:
> given: I know about @import and cascading styles, etc etc.
>
> Is is cool to parse .css files with php? =A0Like I may want to include()
> sections into an overall .css. =A0Or i may want to do like color:#<?php
> echo $thecolor; ?>. =A0That kind of stuff.
>
> I guess there might be a little more overhead, but what's a few .css
> files within a whole cms like wordpress? =A0I'm just looking for gotchas
> and unforseen problems.
>
> thanks,
> j

I suspect a more normal way to do this would be to use php files to
generate your css rather like you would use them to generate your
html. So in the html sent to the browser you would have:
<link type=3D"text/css" rel=3D"stylesheet" media=3D"screen" charset=3D"utf-=
8"
href=3D"http://www.example.com/dynamic_css.php?anyparms">

and dynamic_css.php would return the css.
0
paul_lautman (2109)
1/17/2012 12:32:16 PM
On Jan 17, 4:32=A0am, Captain Paralytic <paul_laut...@yahoo.com> wrote:
> On Jan 16, 9:36=A0pm, "J. Frank Parnell" <jugl...@gmail.com> wrote:
>
> > given: I know about @import and cascading styles, etc etc.
>
> > Is is cool to parse .css files with php? =A0Like I may want to include(=
)
> > sections into an overall .css. =A0Or i may want to do like color:#<?php
> > echo $thecolor; ?>. =A0That kind of stuff.
>
> > I guess there might be a little more overhead, but what's a few .css
> > files within a whole cms like wordpress? =A0I'm just looking for gotcha=
s
> > and unforseen problems.
>
> > thanks,
> > j
>
> I suspect a more normal way to do this would be to use php files to
> generate your css rather like you would use them to generate your
> html. So in the html sent to the browser you would have:
> <link type=3D"text/css" rel=3D"stylesheet" media=3D"screen" charset=3D"ut=
f-8"
> href=3D"http://www.example.com/dynamic_css.php?anyparms">
>
> and dynamic_css.php would return the css.

ok, yeah, this would be my preferred way of the three suggestions
(thanks all!).  Then, i suppose, I would need to set proper headers in
the php file?  or maybe it would come thru fine by itself?
0
juglesh689 (16)
1/19/2012 8:45:26 PM
On Jan 19, 8:45=A0pm, "J. Frank Parnell" <jugl...@gmail.com> wrote:
> On Jan 17, 4:32=A0am, Captain Paralytic <paul_laut...@yahoo.com> wrote:
>
>
>
>
>
>
>
>
>
> > On Jan 16, 9:36=A0pm, "J. Frank Parnell" <jugl...@gmail.com> wrote:
>
> > > given: I know about @import and cascading styles, etc etc.
>
> > > Is is cool to parse .css files with php? =A0Like I may want to includ=
e()
> > > sections into an overall .css. =A0Or i may want to do like color:#<?p=
hp
> > > echo $thecolor; ?>. =A0That kind of stuff.
>
> > > I guess there might be a little more overhead, but what's a few .css
> > > files within a whole cms like wordpress? =A0I'm just looking for gotc=
has
> > > and unforseen problems.
>
> > > thanks,
> > > j
>
> > I suspect a more normal way to do this would be to use php files to
> > generate your css rather like you would use them to generate your
> > html. So in the html sent to the browser you would have:
> > <link type=3D"text/css" rel=3D"stylesheet" media=3D"screen" charset=3D"=
utf-8"
> > href=3D"http://www.example.com/dynamic_css.php?anyparms">
>
> > and dynamic_css.php would return the css.
>
> ok, yeah, this would be my preferred way of the three suggestions
> (thanks all!). =A0Then, i suppose, I would need to set proper headers in
> the php file? =A0or maybe it would come thru fine by itself?

The latter
0
paul_lautman (2109)
1/20/2012 10:07:56 AM
..oO(Captain Paralytic)

>On Jan 19, 8:45�pm, "J. Frank Parnell" <jugl...@gmail.com> wrote:
>> On Jan 17, 4:32�am, Captain Paralytic <paul_laut...@yahoo.com> wrote:
>> > I suspect a more normal way to do this would be to use php files to
>> > generate your css rather like you would use them to generate your
>> > html. So in the html sent to the browser you would have:
>> > <link type="text/css" rel="stylesheet" media="screen" charset="utf-8"
>> > href="http://www.example.com/dynamic_css.php?anyparms">
>>
>> > and dynamic_css.php would return the css.
>>
>> ok, yeah, this would be my preferred way of the three suggestions
>> (thanks all!). �Then, i suppose, I would need to set proper headers in
>> the php file? �or maybe it would come thru fine by itself?
>
>The latter

No. You have to explicitly send the correct header or some browsers
might ignore the CSS. For example

header('Content-Type: text/css; charset=UTF-8')

Micha

-- 
http://mfesser.de/blickwinkel
0
netizen9200 (1826)
1/20/2012 10:25:01 AM
On Jan 20, 10:25=A0am, Michael Fesser <neti...@gmx.de> wrote:
> .oO(Captain Paralytic)
>
> >On Jan 19, 8:45=A0pm, "J. Frank Parnell" <jugl...@gmail.com> wrote:
> >> On Jan 17, 4:32=A0am, Captain Paralytic <paul_laut...@yahoo.com> wrote=
:
> >> > I suspect a more normal way to do this would be to use php files to
> >> > generate your css rather like you would use them to generate your
> >> > html. So in the html sent to the browser you would have:
> >> > <link type=3D"text/css" rel=3D"stylesheet" media=3D"screen" charset=
=3D"utf-8"
> >> > href=3D"http://www.example.com/dynamic_css.php?anyparms">
>
> >> > and dynamic_css.php would return the css.
>
> >> ok, yeah, this would be my preferred way of the three suggestions
> >> (thanks all!). =A0Then, i suppose, I would need to set proper headers =
in
> >> the php file? =A0or maybe it would come thru fine by itself?
>
> >The latter
>
> No. You have to explicitly send the correct header or some browsers
> might ignore the CSS. For example
>
> header('Content-Type: text/css; charset=3DUTF-8')
>
> Micha
>
> --http://mfesser.de/blickwinkel

Oh OK. Any ideas which ones?
0
paul_lautman (2109)
1/20/2012 1:33:53 PM
..oO(Captain Paralytic)

>On Jan 20, 10:25�am, Michael Fesser <neti...@gmx.de> wrote:
>> No. You have to explicitly send the correct header or some browsers
>> might ignore the CSS. For example
>>
>> header('Content-Type: text/css; charset=UTF-8')
>
>Oh OK. Any ideas which ones?

In the past Gecko browsers (i.e. Firefox) were a bit picky about the
correct CSS content type. If the file wasn't delivered as text/css, it
was ignored.

Micha

-- 
http://mfesser.de/blickwinkel
0
netizen9200 (1826)
1/20/2012 2:05:45 PM
Michael Fesser wrote:
> .oO(Captain Paralytic)
>
>   
>> On Jan 20, 10:25 am, Michael Fesser <neti...@gmx.de> wrote:
>>     
>>> No. You have to explicitly send the correct header or some browsers
>>> might ignore the CSS. For example
>>>
>>> header('Content-Type: text/css; charset=UTF-8')
>>>       
>> Oh OK. Any ideas which ones?
>>     
>
> In the past Gecko browsers (i.e. Firefox) were a bit picky about the
> correct CSS content type. If the file wasn't delivered as text/css, it
> was ignored.
>
> Micha

I have successfully used:
header("Content-type: text/css");

After implementing a php based style sheet a couple of different times 
it seemed wasteful, and a bit of a kludge. If the style sheet is 
ultimately static, it is wasteful to keep generating one every time it 
is used. Now I use a php script to generate the style sheet file for me. 
If I want to make changes I edit the php based file (or any included 
definition files, e.g., colors.php) and run it.

-- 
*****************************
 Chuck Anderson � Boulder, CO
  http://cycletourist.com
 Turn Off, Tune Out, Drop In
*****************************
0
1/21/2012 1:50:19 AM
Chuck Anderson wrote:
> Michael Fesser wrote:
>> .oO(Captain Paralytic)
>>
>>> On Jan 20, 10:25 am, Michael Fesser <neti...@gmx.de> wrote:
>>>> No. You have to explicitly send the correct header or some browsers
>>>> might ignore the CSS. For example
>>>>
>>>> header('Content-Type: text/css; charset=UTF-8')
>>> Oh OK. Any ideas which ones?
>>
>> In the past Gecko browsers (i.e. Firefox) were a bit picky about the
>> correct CSS content type. If the file wasn't delivered as text/css, it
>> was ignored.
>>
> I have successfully used:
> header("Content-type: text/css");
>
> After implementing a php based style sheet a couple of different times it
> seemed wasteful, and a bit of a kludge. If the style sheet is ultimately
> static, it is wasteful to keep generating one every time it is used. Now I use
> a php script to generate the style sheet file for me. If I want to make
> changes I edit the php based file (or any included definition files, e.g.,
> colors.php) and run it.
>

I have to say it feels quite much of extra work, writing the php script which 
generates the css, as you need to edit the php file, then IMHO you can quite 
easily edit a css instead. I could see a bit more point of your script if you 
have a database as a backend, where you store the values and recreate the css 
each time the values change.


-- 

   //Aho
0
user7 (4036)
1/21/2012 7:10:28 AM
J.O. Aho wrote:
> Chuck Anderson wrote:
>> Michael Fesser wrote:
>>> .oO(Captain Paralytic)
>>>
>>>> On Jan 20, 10:25 am, Michael Fesser <neti...@gmx.de> wrote:
>>>>> No. You have to explicitly send the correct header or some browsers
>>>>> might ignore the CSS. For example
>>>>>
>>>>> header('Content-Type: text/css; charset=UTF-8')
>>>> Oh OK. Any ideas which ones?
>>>
>>> In the past Gecko browsers (i.e. Firefox) were a bit picky about the
>>> correct CSS content type. If the file wasn't delivered as text/css, it
>>> was ignored.
>>>
>> I have successfully used:
>> header("Content-type: text/css");
>>
>> After implementing a php based style sheet a couple of different 
>> times it
>> seemed wasteful, and a bit of a kludge. If the style sheet is ultimately
>> static, it is wasteful to keep generating one every time it is used. 
>> Now I use
>> a php script to generate the style sheet file for me. If I want to make
>> changes I edit the php based file (or any included definition files, 
>> e.g.,
>> colors.php) and run it.
>>
>
> I have to say it feels quite much of extra work, writing the php 
> script which generates the css, as you need to edit the php file, then 
> IMHO you can quite easily edit a css instead. 

I edit one php file and then simply invoke it.  There is very little 
more "work."

In preparation, I write a script that opens a file for writing (the css 
file) and then one long heredoc to create it's contents.  This creates 
an easily reusable system for very little extra work.

> I could see a bit more point of your script if you have a database as 
> a backend, where you store the values and recreate the css each time 
> the values change.

It's not a database, but I include color definitions from a separate php 
file.

-- 
*****************************
 Chuck Anderson • Boulder, CO
  http://cycletourist.com
 Turn Off, Tune Out, Drop In
*****************************
0
1/21/2012 7:31:58 PM
On 1/21/2012 2:31 PM, Chuck Anderson wrote:
> J.O. Aho wrote:
>> Chuck Anderson wrote:
>>> Michael Fesser wrote:
>>>> .oO(Captain Paralytic)
>>>>
>>>>> On Jan 20, 10:25 am, Michael Fesser <neti...@gmx.de> wrote:
>>>>>> No. You have to explicitly send the correct header or some browsers
>>>>>> might ignore the CSS. For example
>>>>>>
>>>>>> header('Content-Type: text/css; charset=UTF-8')
>>>>> Oh OK. Any ideas which ones?
>>>>
>>>> In the past Gecko browsers (i.e. Firefox) were a bit picky about the
>>>> correct CSS content type. If the file wasn't delivered as text/css, it
>>>> was ignored.
>>>>
>>> I have successfully used:
>>> header("Content-type: text/css");
>>>
>>> After implementing a php based style sheet a couple of different
>>> times it
>>> seemed wasteful, and a bit of a kludge. If the style sheet is ultimately
>>> static, it is wasteful to keep generating one every time it is used.
>>> Now I use
>>> a php script to generate the style sheet file for me. If I want to make
>>> changes I edit the php based file (or any included definition files,
>>> e.g.,
>>> colors.php) and run it.
>>>
>>
>> I have to say it feels quite much of extra work, writing the php
>> script which generates the css, as you need to edit the php file, then
>> IMHO you can quite easily edit a css instead.
>
> I edit one php file and then simply invoke it. There is very little more
> "work."
>
> In preparation, I write a script that opens a file for writing (the css
> file) and then one long heredoc to create it's contents. This creates an
> easily reusable system for very little extra work.
>
>> I could see a bit more point of your script if you have a database as
>> a backend, where you store the values and recreate the css each time
>> the values change.
>
> It's not a database, but I include color definitions from a separate php
> file.
>

I agree with J.O.  Seems overly complicated to have to edit a PHP file 
which then generates the CSS.  Much easier just to edit the CSS - 
especially when you have syntax-sensitive editors for CSS available.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
0
jstucklex (14659)
1/21/2012 8:53:46 PM
Reply:

Similar Artilces:

PHP does not parse .PHP files
I have this problem with PHP that someone might be able to help. With CLI, I am able to execute my .php files. For example, if I type "php phpinfo.php" , this works fine on my system. If I put the phpinfo.php file is in /var/www/html and I try to access it through the browser, I get the content of the file and not the execution of the file. Instead of display the info of PHP, I got the text of the file as: <?php phpinfo(); ?> Why? Thanks Phong Ho wrote: >I have this problem with PHP that someone might be able to help. > >With CLI, I am able to execute my ....

Parsing a php include (which also contains php code)
Hello, I am using the <?php include() ?> statement on my website for organizational purposes. However, one of my includes contains some PHP code. Is there any way for the server to actually parse the include? I've tried this before, and it did not parse the include. Rather, it included the file as just plain ASCII. ======================= /*EXAMPLE 1*/ /*index.php*/ .... <?php include('global/includes/footer.inc') ?> .... /*footer.inc*/ .... <p>&copy 1993-<?php echo date("Y") ?> Kingswood School. All rights reserved.</p> .... /*EXA...

Open .php file with PHP Designer 2007 by clicking the file in XP
In windows XP, I want to be able to click on a .php file and have it opened in PHP Designer 2007, Or right-click on it and have an "edit" menu option presented to me. I know how to tweak the registry to do this in general, but what would the command line look like in this specific case ? PHP Designer does not do this automatically. It is as if the program does not allow commandline options. It only opens with the last file used or a menu of recently opened files. ...

want to get content of one php file in another php file
i have one php file having content Contents of ex1.php file <body> <?php $content = "c://webserver/www/abc.php"; $handle = fopen($content, "r"); echo fread($handle,filesize($content)); ?> </body> this is reading abc.php file in which i m simply using an echo statement. When i execute ex1.php file i cant see the php statement of abc.php file content of abc.php file is <?php echo "hello";?> sarika wrote: > i have one php file having content > > Contents of ex1.php file > <body> > <?php > $content = "c://webserver/www/abc.php"; > $handle = fopen($content, "r"); > echo fread($handle,filesize($content)); > ?> > </body> > this is reading abc.php file in which i m simply using an echo > statement. When i execute ex1.php file i cant see the php statement of > abc.php file > > content of abc.php file is > <?php echo "hello";?> That's interesting, I've found out that it's the browser that's hiding <?php ?> tags within .phpx pages. Probably to avoid short tags scripts (on a server that doesn't allow them) from getting leaked by visitors who don't know about this browser trick, until the dev' realizes his error. Not a good thing, IMO; dev's should take care, themselves, and it's still not secure since the hidden string is still in the rendered source. And now we don't know how ...

Is a PHP variable supposed to be seen in a .js file included into a .php file
Is a PHP variable supposed to be seen in a .js file included into a .php file? I have a client side javascript code stored in a .js file which is included into a PHP file using <script src="filename.js></script> This code initialises a Javascript variable var u="string"; The string is supposed to be the value of $HTTP_HOST So, when initialise this variable like var u=<? echo $HTTP_HOST;?>; I sterted getting a javascript message Syntax Error Am I doing something wrong, or PHP variables are not seen in included js files? aa wrote: > Is a PHP variable supposed to be seen in a .js file included into a .php > file? > > I have a client side javascript code stored in a .js file which is included > into a PHP file using > <script src="filename.js></script> > > This code initialises a Javascript variable > var u="string"; > > The string is supposed to be the value of $HTTP_HOST > > So, when initialise this variable like > > var u=<? echo $HTTP_HOST;?>; > > I sterted getting a javascript message Syntax Error > > Am I doing something wrong, or PHP variables are not seen in included js > files? js files are not parsed for PHP code unless you specifically tell the webserver to do so. Therefore, "var u=<? echo $HTTP_HOST;?>;" in the .js will error since the browser doesn't know what to do. -- Justin Koivisto - spam@koiv...

When does the php interpreter loads the php file?
Hi All, I'm wondering three facts about php, apache and apache module. 1.How can i differentiate the php intepreter if it's running as a apache module or as cgi? 2.When does the php interpretor loads the php file to main memory? 3.and till when it keeps the php file on memory? - in my experience only after installing Zend it caches the php file. Thak you *** Kim Gijung wrote/escribi� (20 Oct 2004 00:03:35 -0700): > 1.How can i differentiate the php intepreter if it's running as a > apache module or as cgi? If I recall correctly phpinfo() calls it "Server API&qu...

Modify a php file(model) with php
I have an invoice model on my server! and i want to replace some field(like adresse, phone, price, VAT, ....) do you know a tools or class that allows those kind of manipulations Thanks you Yoni Yoni Alhadeff a �crit : > I have an invoice model on my server! and i want to replace some field(like > adresse, phone, price, VAT, ....) > > do you know a tools or class that allows those kind of manipulations > > Thanks you > > Yoni > > Couldn't you replace field with var and have them set when including your template (it become one in fact) ? I didn'...

php assembly of multiple php files
I am trying to combine multiple php pages into 1. Basically I have created a shell page and then a seperate php file for each form to be included within the shell. The problem I am having is that when a user submits one of the forms the main shell and the other php files POST values are all returned as NULL and I only get the values pertaining to the form that was submitted?. If all the files were combined into one very long php file, I would get all the POSTs returned how can I do the same but with multiple files? When you submit an include, do the POST values not get passed back to the Main calling page? Thank you, QB Question Boy wrote: > I am trying to combine multiple php pages into 1. > > Basically I have created a shell page and then a seperate php file for > each form to be included within the shell. > > The problem I am having is that when a user submits one of the forms > the main shell and the other php files POST values are all returned as > NULL and I only get the values pertaining to the form that was > submitted?. If all the files were combined into one very long php > file, I would get all the POSTs returned how can I do the same but > with multiple files? > > When you submit an include, do the POST values not get passed back to > the Main calling page? > > Thank you, > > QB This has nothing to do with PHP - it's how HTML works. The browser will only send the data for the form being subm...

SSI Including PHP File Within PHP File Causes Seg Fault and Crash
Can somebody concur or verify the following? I'm having this problem on all of my installations. I've got Apache 2.0.40 and PHP 4.2.2 installed and configured from RedHat RPMs. Nothing out of the ordinary. In the httpd.conf file, PHP files are called with the following: <Files *.php> SetOutputFilter PHP;INCLUDES SetInputFilter PHP LimitRequestBody 524288 </Files> I create two files as follows: /test1.php <!--#include virtaul="/test2.php" --> and /test2.php Testing 1 2 3 By going to http://host/test1.php, it may or may not display the fi...

PHP Training Institute In Delhi, Live Projects on PHP. Short Term PHP Courses, PHP Scripts, PHP Training with Live Projects.
Vserve Global offers short term PHP: Hypertext Preprocessor Training Course, which is a widely used, general-purpose scripting language that was originally designed for web development, to produce dynamic web pages. It can be embedded into HTML and generally runs on a web server, which needs to be configured to process PHP code and create web page content from it. It can be deployed on most web servers and on almost every operating system and platform free of charge.PHP is installed on over 20 million websites and 1 million web servers. TOPICS:- >> Core PHP Language >> HTML, Cascad...

php sessions and css file?
Is it possible to use a css file if you are using php sessions to login? Here is my code: valid.php ..... if($count==1){ $_SESSION['loggedin'] = 1;// Set session variable header("Location: protect.php");//header must be the first printed line! protect.php <?php session_start(); // Call this function so your page // can access session variables if($_SESSION['loggedin'] != 1) { // If the 'loggedin' session variable // is not equal to 1, then you must // not let the user see the page. // So, we'll redirect them to the // login page (login.php). header("Location: index.html"); exit; } ?> <html> <head> <title>DOLF Project Log In</title> <link rel="stylesheet" type="text/css" href="layout.css" media="screen" /> </head> <body> ..... On 4/26/2011 4:46 PM, Alex Pavluck wrote: > Is it possible to use a css file if you are using php sessions to > login? Yes, they are completely different concepts. So, unless you try to mix them somehow, they have nothing to do with each other. > > Here is my code: > > valid.php > .... > if($count==1){ > > $_SESSION['loggedin'] = 1;// Set session variable > header("Location: protect.php");//header must be the first printed > line! Did you add an: exit; after that header? ...

Why are my PHP files are not being executed (PHP keywords/syntax being ignored)
I have been hosting a website on the same server for roughly 2 years. The entire site is based on a group of PHP scripts. Today, without changing a thing, the server stopped recognizing all PHP keywords and syntax. When I use firefox, the page simply displays a text/plain version of my source code. When I use IE, the page loads as text/html, however, all lines of PHP code (between "<?" and "?>") are displayed as text. My assumption is that my host has stopped providing PHP extensions. Can anybody confirm this or give me another explanation? All help is greatly ap...

PHP within PHP...
I took over the support of a website that is set up something like this inside one of the pages: include_once("header.php"); <?php //to get the content of the page they do this: $content = mysql_query("select content etc...); echo $content; ?> include_once("footer.php"); I am having problems evaluating any php that is used in the mysql content. Is there a way to get the mysql withing the mysql to run? Thank you for your time, Mandragon On Sep 17, 12:56 pm, Mandrago...@gmail.com wrote: > I took over the support of a website that is set up something like > this inside one of the pages: > > include_once("header.php"); > > <?php > //to get the content of the page they do this: > $content = mysql_query("select content etc...); > > echo $content; > ?> > > include_once("footer.php"); > > I am having problems evaluating any php that is used in the mysql > content. Is there a way to get the mysql withing the mysql to run? > > Thank you for your time, > > Mandragon Sorry, The question should read: "Is there a way to get the php withing the echo $htmlcontent to run?" Of course you are, $content is a resource. The MySQL Query resource. try this: $content = mysql_query('bla bla bla'); while ($row = mysql_fetch_assoc($content)) { $result[] = $row; } $content = $result; Now you can use $content ;). In answer to your edit... eval($co...

php outside php (?)
Sounds weird, i know. What i want/wonder is the following: PHP can do the next: <?php if($foo == 'bar') { ?> Ow yeah, foo is bar! <?php }; ?> But how can i do the following: <?php $foo= ?> this is what foo looks like. <?php }; ?> This way i could edit the content of $foo in DW's design-view. I hope it's clear enough for you all to understand... Greetings frizzle. frizzle wrote: > But how can i do the following: > > <?php > > $foo= > > ?> > this is what foo looks like. > <?php > > }; > > ?> > > This way i could edit the content of $foo in DW's design-view. > I hope it's clear enough for you all to understand... <?php ob_start(); ?> this is what foo looks like. <?php $foo=ob_get_clean(); ?> -- Justin Koivisto - justin@koivi.com http://koivi.com Wow, little late on the reply, but i still wanted to thank you for your help. This is exactly what i meant, and it works great! :D Thanks again. ...

php to php obj
Hi All, Is there any tool to convert the .php files into its object files in deploying the files to other's server like java classes are deployed? Thanks in advance --AR John7481 <arjohn7481@hotmail.com> wrote or quoted: > Is there any tool to convert the .php files into its object files in > deploying the files to other's server like java classes are deployed? To what end? Do you want a PHP obfuscator? They tend not to be needed - since the code remains on the server. Do you want a PHP squeezer? Again - since PHP remains on the server that is of reduced importance. PHP obfuscators and squeezers are out there - but what exactly are you looking for? -- __________ |im |yler http://timtyler.org/ tim@tt1lock.org Remove lock to reply. With total disregard for any kind of safety measures Tim Tyler <tim@tt1lock.org> leapt forth and uttered: > John7481 <arjohn7481@hotmail.com> wrote or quoted: > >> Is there any tool to convert the .php files into its object >> files in deploying the files to other's server like java >> classes are deployed? > > To what end? > > Do you want a PHP obfuscator? They tend not to be needed - > since the code remains on the server. > > Do you want a PHP squeezer? Again - since PHP remains on the > server that is of reduced importance. > > PHP obfuscators and squeezers are out there - but what exactly > are you looking for? I think he'...

Parse XML files with PHP
Hullo everybody, gals and guys! I have been looking for ages for some API to parse a very large XML file, with thousands of nodes in it. I needed to parse the XML file and access its nodes and children. In particular I needed to get certain children from a specified path in the passed XML file. Unfortunately all the classes I found didn't help that much (in particular the CXml you find named in Google).. I got an arry as a result, and it was too difficult to work with it.. But.. luckily I found what I was looking for! It's called MiniXML, you can download at http://minixml.psychogeni...

Failed opening required 'PEAR.php' (include_path='F:\www\include') in F:\Program Files\PHP\PEAR\Text\CAPTCHA.php on line 22
Hi, Guys=EF=BC=8Cwhen I run my site ,I got some errors: Warning: require_once(PEAR.php) [function.require-once]: failed to open stream: No such file or directory in F:\Program Files\PHP\PEAR \Text\CAPTCHA.php on line 22 Fatal error: require_once() [function.require]: Failed opening required 'PEAR.php' (include_path=3D'F:\www\include') in F:\Program Files \PHP\PEAR\Text\CAPTCHA.php on line 22 It appears that it cann't find the pear.php ,but i checked my dir,and this file was there,and also I have my php.ini file checked,the include_path=3Dinclude_path=3D".;F:\Program Files\PHP\pear;F:\www \include" ,it looks all right,was there anything I have missed in the config file?Or something wrong ? Wish somebody can help me out. Thanks, Mikay >Warning: require_once(PEAR.php) [function.require-once]: failed to >open stream: No such file or directory in F:\Program Files\PHP\PEAR >\Text\CAPTCHA.php on line 22 >Fatal error: require_once() [function.require]: Failed opening >required 'PEAR.php' (include_path='F:\www\include') in F:\Program Files >\PHP\PEAR\Text\CAPTCHA.php on line 22 So where is the pear.php file? >It appears that it cann't find the pear.php ,but i checked my dir,and >this file was there,and also I have my php.ini file checked,the >include_path=include_path=".;F:\Program Files\PHP\pear;F:\www >\include" ,it looks all right,was there anything I have missed in the >config...

testing PHP 5 with Apache 2 and php info file
When I go to look for php info file in the browser all i get is the actually words. <?php phpinfo(); ?> any obvious problems? thanks ...

testing PHP 5 with Apache 2 and php info file
When I go to look for php info file in the browser all i get is the actually words. <?php phpinfo(); ?> any obvious problems? thanks ...

how to mark php document as cachable (expires only when php file changes)
Hi, I'm new to cahce control, so I hope my question makes sense. let's assume a small php file like <html><body> <?php $max=10; for($i=0;$i<$max;$i++){ print("$i<br>\n"); } ?> </body></html> Obviously the output of this file is predictably constant as it would be for any html file. I assume, that apache would allow a foreign browser to detect, that a html file (creation date or expire) does not have to be reloaded except it has been updated on the server. On the other hand I assume, that php will set the expire attributes f...

Free PHP Template with External CSS (server must have php)
SSI / PHP Template For Websites PHP Template with External CSS browse down the page, and there are the four files, and then get the graphics from the base link. This one works like a charm. Free Template: http://www.ibdhost.com/help/templates/ Free Software: http://wholives.com/tools/freestuff.htm Hats wrote: > SSI / PHP Template For Websites > PHP Template with External CSS > browse down the page, and there are the four files, and then get the > graphics from the base link. This one works like a charm. > > Free Template: http://www.ibdhost.com/help/templates/ > >...

parsing an xml file via php
hey everybody, does anyone know a good internet page where I can found some examples how to parse xml files by php..... all the pages I found give me too little information, so I was not able to solve my whole prob. thanks in advance, thomas Hi, I used clsParseXML. This is the header from the file itself: /* XML Parser Class by Eric Rosebrock http://www.phpfreaks.com Class originated from: kris@h3x.com AT: http://www.devdump.com/phpxml.php Usage: <?php include 'clsParseXML.php'; $xmlparse = &new ParseXML; $xml = $xmlparse->GetXMLTree('/path/to/xmlfile.xml')...

Parsing mbox files with Windows Php
I have been slowly building a Php/MySQL based IMAP email client. The Php IMAP functions are well documented and easy to use. I store messages in a MySQL database (attachments in the file system) for ease of organization, maintenance, backup and searching. I like it enough that I want to add my existing archive of email in Thunderbird. To do so, I need to parse mbox files and extract message headers, parts, and attachments. Thankfully, the Php IMAP functions can be used to open and parse an mbox file (or even a single .eml file) as well as opening a stream to the server. Using this functionality I can write a script to run on my WAMP development machine that reads the Thunderbird folder structure, parses the mbox files and saves individual messages along with their folder/subfolder path in the Thunderbird folder hierarchy. It should be as easy as pointing it to the top of the folder structure and letting it do all the work from there. Unfortunately, it appears that the Windows Php binary is unable to connect to an mbox file, so to make my job easy, I would have to upload the entire folder structure (it is about 200MBs) to my shared host and process it there. I would much rather "toy around" with this process on my Windows development machine and not on the shared host. There is a Php bug filed for this, but it was determined that the "underlying c-client function is unable to open a file." https://bug...

Read *parsed* PHP file into a variable?
Hello, I have this strange including problem: I want to read a piece of HTML, residing in some file, into a variable, not echo it out. So far so easy - but now the HTML contains a line of PHP. And I wish not to get the PHP code into my variable but the parsed result, just like if the variable was a client ;-). I wish to keep the nice ?> ...<? HTML area (with highlighting in my editor), and therefore include etc. don't help because they would echo it out. heredoc also doesnt help (if this may come up to your mind). Is there anything I can do...?!! The problem sounds so simple... t...

Web resources about - Parsing .css files with php: Cons? - comp.lang.php

Parsing - Wikipedia, the free encyclopedia
Parsing or syntactic analysis is the process of analysing a string of symbols , either in natural language or in computer languages , conforming ...

Parsing - Wikipedia, the free encyclopedia
Parsing or syntactic analysis is the process of analysing a string of symbols, either in natural language or in computer languages , according ...

Parsing - Wikipedia, the free encyclopedia
Parsing or syntactic analysis is the process of analysing a string of symbols, either in natural language or in computer languages , according ...

Parsing Parse’s worldwide growth
Parse, the app development platform Facebook purchased last April , is seeing some incredible growth worldwide. Parse CEO Ilya Sukhar recently ...

17 - 1 - Dependency Parsing Introduction-Stanford NLP-Professor Dan Jurafsky & Chris Manning - YouTube ...
If you are interest on more free online course info, welcome to: http://opencourseonline.com/ Professor Dan Jurafsky & Chris Manning are offering ...

Representative Line: JavaScript JSON Parsing
No data interchange format is perfect. ASN.1 ( Abstract Syntax Notation One ) is probably the closest (it's by far the most flexible and comprehensive), ...

Parsing the Unity Bill
The NDP is wrong on secession, the Clarity Act and the Supreme Court

Google Hangouts for Android getting smarter with natural language parsing, consolidated contacts
You've long been able to share your location with contacts in Hangouts chats, but the Google Hangouts for Android app is today getting a little ...

Parsing the difference between the Internet and the Web according to Alan Kay
Stack Exchange This Q&A is part of a weekly series of posts highlighting common questions encountered by technophiles and answered by users ...

Feature Friday: Phone Number Parsing
... I am pretty sure the former is not. I’ve talked to a few people about this and what I am told is that the Android OS has phone number parsing ...

Resources last updated: 3/23/2016 4:00:15 PM