Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

procmail change subject header, wwwXxx not20, Wwwxxx.doks sas, linux raid resync after reboot, bind-address mysql multiple, sanibleone xxxx, ftp://192.168.100.100/, www.xxxcon, which comes first ob_start or session, wwwxxx/58/2010

Links

XODOX
Impressum

#1: PHP newbie (generating HTML content in a generic way)- HOW ?

Posted on 2008-04-10 17:52:14 by Ronald Raygun

Sorry for the crossposting - I'm not sure which is the most
active/relevant php ng yet ....


Hi, I am a PHP newbie, but have been programming C/C++ for over 10
years, so in that respect, I'm not a programming noob.

I am putting together a few web pages and I want to 'modularize' the
page content into 'blocks', so that I have php script responsible for
creating different blocks - e.g.

header.php (responsible for creating header section)
footer.php (responsible for creating footer section)
lhsnavig.php (responsible for creating lefthandside menu navigation section)

etc ....

can some one please provide me with skeleton code that I can use to
create such a 'framework' ? MTIA

Report this message

#2: Re: PHP newbie (generating HTML content in a generic way)- HOW ?

Posted on 2008-04-10 18:05:46 by Guillaume

Ronald Raygun a écrit :
> can some one please provide me with skeleton code that I can use to
> create such a 'framework' ? MTIA

Smarty is an easy one, not really a framework, it's a template engine
which can help you with your request.

http://www.smarty.net/

Regards,
--
Guillaume

Report this message

#3: Re: PHP newbie (generating HTML content in a generic way)- HOW ?

Posted on 2008-04-10 18:05:46 by Guillaume

Ronald Raygun a écrit :
> can some one please provide me with skeleton code that I can use to
> create such a 'framework' ? MTIA

Smarty is an easy one, not really a framework, it's a template engine
which can help you with your request.

http://www.smarty.net/

Regards,
--
Guillaume

Report this message

#4: Re: PHP newbie (generating HTML content in a generic way)- HOW ?

Posted on 2008-04-10 18:35:09 by Ronald Raygun

Guillaume wrote:
> Ronald Raygun a écrit :
>
>> can some one please provide me with skeleton code that I can use to
>> create such a 'framework' ? MTIA
>
>
> Smarty is an easy one, not really a framework, it's a template engine
> which can help you with your request.
>
> http://www.smarty.net/
>
> Regards,


Hi Guillame,

I know about smarty - even though its quite 'lightweight', its too much
of an overhead (not to mention leaning curve) for what I want to do,
which is create little scripts, each of which generates a 'block' of
html code - and then combining all of the little 'blocks' of html into
an html code.

This way, I can easily and quickly, build little libraries (PHP
scripts), each of which builds specific html 'blocks', e.g. navigation
menus etc, so I can quickly put a page together using these blocks.

The problem is not how to write the script that generates the html
(thats basically a case of using the echo statement), its how I can use
those 'little blocks' in a single page - this will save me typing the
same text over and over in my pages - and also reduce possibility of
error, provide code resuse etc, etc...

Report this message

#5: Re: PHP newbie (generating HTML content in a generic way)- HOW ?

Posted on 2008-04-10 18:35:09 by Ronald Raygun

Guillaume wrote:
> Ronald Raygun a écrit :
>
>> can some one please provide me with skeleton code that I can use to
>> create such a 'framework' ? MTIA
>
>
> Smarty is an easy one, not really a framework, it's a template engine
> which can help you with your request.
>
> http://www.smarty.net/
>
> Regards,


Hi Guillame,

I know about smarty - even though its quite 'lightweight', its too much
of an overhead (not to mention leaning curve) for what I want to do,
which is create little scripts, each of which generates a 'block' of
html code - and then combining all of the little 'blocks' of html into
an html code.

This way, I can easily and quickly, build little libraries (PHP
scripts), each of which builds specific html 'blocks', e.g. navigation
menus etc, so I can quickly put a page together using these blocks.

The problem is not how to write the script that generates the html
(thats basically a case of using the echo statement), its how I can use
those 'little blocks' in a single page - this will save me typing the
same text over and over in my pages - and also reduce possibility of
error, provide code resuse etc, etc...

Report this message

#6: Re: PHP newbie (generating HTML content in a generic way)- HOW ?

Posted on 2008-04-10 19:07:46 by zeldorblat

On Apr 10, 12:35 pm, Ronald Raygun <inva...@domain.com> wrote:
> Guillaume wrote:
> > Ronald Raygun a =E9crit :
>
> >> can some one please provide me with skeleton code that I can use to
> >> create such a 'framework' ? MTIA
>
> > Smarty is an easy one, not really a framework, it's a template engine
> > which can help you with your request.
>
> >http://www.smarty.net/
>
> > Regards,
>
> Hi Guillame,
>
> I know about smarty - even though its quite 'lightweight', its too much
> of an overhead (not to mention leaning curve) for what I want to do,
> which is create little scripts, each of which generates a 'block' of
> html code - and then combining all of the little 'blocks' of html into
> an html code.
>
> This way, I can easily and quickly, build little libraries (PHP
> scripts), each of which builds specific html 'blocks', e.g. navigation
> menus etc, so I can quickly put a page together using these blocks.
>
> The problem is not how to write the script that generates the html
> (thats basically a case of using the echo statement), its how I can use
> those 'little blocks' in a single page - this will save me typing the
> same text over and over in my pages - and also reduce possibility of
> error, provide code resuse etc, etc...

<http://www.php.net/include>

Report this message

#7: Re: PHP newbie (generating HTML content in a generic way)- HOW ?

Posted on 2008-04-10 19:07:46 by zeldorblat

On Apr 10, 12:35 pm, Ronald Raygun <inva...@domain.com> wrote:
> Guillaume wrote:
> > Ronald Raygun a =E9crit :
>
> >> can some one please provide me with skeleton code that I can use to
> >> create such a 'framework' ? MTIA
>
> > Smarty is an easy one, not really a framework, it's a template engine
> > which can help you with your request.
>
> >http://www.smarty.net/
>
> > Regards,
>
> Hi Guillame,
>
> I know about smarty - even though its quite 'lightweight', its too much
> of an overhead (not to mention leaning curve) for what I want to do,
> which is create little scripts, each of which generates a 'block' of
> html code - and then combining all of the little 'blocks' of html into
> an html code.
>
> This way, I can easily and quickly, build little libraries (PHP
> scripts), each of which builds specific html 'blocks', e.g. navigation
> menus etc, so I can quickly put a page together using these blocks.
>
> The problem is not how to write the script that generates the html
> (thats basically a case of using the echo statement), its how I can use
> those 'little blocks' in a single page - this will save me typing the
> same text over and over in my pages - and also reduce possibility of
> error, provide code resuse etc, etc...

<http://www.php.net/include>

Report this message

#8: Re: PHP newbie (generating HTML content in a generic way)- HOW ?

Posted on 2008-04-10 20:41:52 by webmasterNOSPAMTHANKS

*** Ronald Raygun escribió/wrote (Thu, 10 Apr 2008 17:35:09 +0100):
> The problem is not how to write the script that generates the html
> (thats basically a case of using the echo statement), its how I can use
> those 'little blocks' in a single page - this will save me typing the
> same text over and over in my pages - and also reduce possibility of
> error, provide code resuse etc, etc...

If you mean blocks like headers, footers, navigation bars... I've always
kept them in individual files inside a directory called "inc" (for
"included files", since I insert them with the PHP include construct).
They're typically plain HTML with some PHP bits inside.


<div id="footer">
<p>&copy; 2008 by John Smith, generated on <?=date('d/m/y')?>, blah blah</p>
<p>More blah blah.</p>
</div>


My site pages have a very basic skeleton (all design goes in *.css and *.inc.php files):


<?

$title = 'Template';

require($_SERVER['DOCUMENT_ROOT'] . '/inc/config.inc.php');

?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="es">
<head><title>borrame.com &curren; <?=htmlspecialchars($title)?></title>
<? include($_SERVER['DOCUMENT_ROOT'] . '/inc/head.inc.php') ?>
<body>

<? include($_SERVER['DOCUMENT_ROOT'] . '/inc/header.inc.php') ?>
<? include($_SERVER['DOCUMENT_ROOT'] . '/inc/menu.inc.php') ?>
<? include($_SERVER['DOCUMENT_ROOT'] . '/inc/options.inc.php') ?>
<? include($_SERVER['DOCUMENT_ROOT'] . '/inc/recommended.inc.php') ?>

<div id=content>


<h1><?=htmlspecialchars($title></h1>

<? codigo('__plantilla.sql') ?>

<p>Here comes content.</p>

</div>

<? include($_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php') ?>

</body>
</html>





--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor en cubitos: http://www.demogracia.com
--

Report this message

#9: Re: PHP newbie (generating HTML content in a generic way)- HOW ?

Posted on 2008-04-10 20:41:52 by webmasterNOSPAMTHANKS

*** Ronald Raygun escribió/wrote (Thu, 10 Apr 2008 17:35:09 +0100):
> The problem is not how to write the script that generates the html
> (thats basically a case of using the echo statement), its how I can use
> those 'little blocks' in a single page - this will save me typing the
> same text over and over in my pages - and also reduce possibility of
> error, provide code resuse etc, etc...

If you mean blocks like headers, footers, navigation bars... I've always
kept them in individual files inside a directory called "inc" (for
"included files", since I insert them with the PHP include construct).
They're typically plain HTML with some PHP bits inside.


<div id="footer">
<p>&copy; 2008 by John Smith, generated on <?=date('d/m/y')?>, blah blah</p>
<p>More blah blah.</p>
</div>


My site pages have a very basic skeleton (all design goes in *.css and *.inc.php files):


<?

$title = 'Template';

require($_SERVER['DOCUMENT_ROOT'] . '/inc/config.inc.php');

?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="es">
<head><title>borrame.com &curren; <?=htmlspecialchars($title)?></title>
<? include($_SERVER['DOCUMENT_ROOT'] . '/inc/head.inc.php') ?>
<body>

<? include($_SERVER['DOCUMENT_ROOT'] . '/inc/header.inc.php') ?>
<? include($_SERVER['DOCUMENT_ROOT'] . '/inc/menu.inc.php') ?>
<? include($_SERVER['DOCUMENT_ROOT'] . '/inc/options.inc.php') ?>
<? include($_SERVER['DOCUMENT_ROOT'] . '/inc/recommended.inc.php') ?>

<div id=content>


<h1><?=htmlspecialchars($title></h1>

<? codigo('__plantilla.sql') ?>

<p>Here comes content.</p>

</div>

<? include($_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php') ?>

</body>
</html>





--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor en cubitos: http://www.demogracia.com
--

Report this message

#10: Re: PHP newbie (generating HTML content in a generic way)- HOW ?

Posted on 2008-04-10 23:45:17 by Ronald Raygun

Álvaro G. Vicario wrote:
> *** Ronald Raygun escribió/wrote (Thu, 10 Apr 2008 17:35:09 +0100):
>
>>The problem is not how to write the script that generates the html
>>(thats basically a case of using the echo statement), its how I can use
>>those 'little blocks' in a single page - this will save me typing the
>>same text over and over in my pages - and also reduce possibility of
>>error, provide code resuse etc, etc...
>
>
> If you mean blocks like headers, footers, navigation bars... I've always
> kept them in individual files inside a directory called "inc" (for
> "included files", since I insert them with the PHP include construct).
> They're typically plain HTML with some PHP bits inside.
>
>
> <div id="footer">
> <p>&copy; 2008 by John Smith, generated on <?=date('d/m/y')?>, blah blah</p>
> <p>More blah blah.</p>
> </div>
>
>
> My site pages have a very basic skeleton (all design goes in *.css and *.inc.php files):
>
>
> <?
>
> $title = 'Template';
>
> require($_SERVER['DOCUMENT_ROOT'] . '/inc/config.inc.php');
>
> ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
> <html lang="es">
> <head><title>borrame.com &curren; <?=htmlspecialchars($title)?></title>
> <? include($_SERVER['DOCUMENT_ROOT'] . '/inc/head.inc.php') ?>
> <body>
>
> <? include($_SERVER['DOCUMENT_ROOT'] . '/inc/header.inc.php') ?>
> <? include($_SERVER['DOCUMENT_ROOT'] . '/inc/menu.inc.php') ?>
> <? include($_SERVER['DOCUMENT_ROOT'] . '/inc/options.inc.php') ?>
> <? include($_SERVER['DOCUMENT_ROOT'] . '/inc/recommended.inc.php') ?>
>
> <div id=content>
>
>
> <h1><?=htmlspecialchars($title></h1>
>
> <? codigo('__plantilla.sql') ?>
>
> <p>Here comes content.</p>
>
> </div>
>
> <? include($_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php') ?>
>
> </body>
> </html>
>
>
>
>
>

Thanks Álvaro, this looks like EXACTLY what I was looking for. By the
way, what is the codigo() function used for ? (is it a spanish word or a
PHP keyword)?

Report this message

#11: Re: PHP newbie (generating HTML content in a generic way)- HOW ?

Posted on 2008-04-10 23:45:17 by Ronald Raygun

Álvaro G. Vicario wrote:
> *** Ronald Raygun escribió/wrote (Thu, 10 Apr 2008 17:35:09 +0100):
>
>>The problem is not how to write the script that generates the html
>>(thats basically a case of using the echo statement), its how I can use
>>those 'little blocks' in a single page - this will save me typing the
>>same text over and over in my pages - and also reduce possibility of
>>error, provide code resuse etc, etc...
>
>
> If you mean blocks like headers, footers, navigation bars... I've always
> kept them in individual files inside a directory called "inc" (for
> "included files", since I insert them with the PHP include construct).
> They're typically plain HTML with some PHP bits inside.
>
>
> <div id="footer">
> <p>&copy; 2008 by John Smith, generated on <?=date('d/m/y')?>, blah blah</p>
> <p>More blah blah.</p>
> </div>
>
>
> My site pages have a very basic skeleton (all design goes in *.css and *.inc.php files):
>
>
> <?
>
> $title = 'Template';
>
> require($_SERVER['DOCUMENT_ROOT'] . '/inc/config.inc.php');
>
> ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
> <html lang="es">
> <head><title>borrame.com &curren; <?=htmlspecialchars($title)?></title>
> <? include($_SERVER['DOCUMENT_ROOT'] . '/inc/head.inc.php') ?>
> <body>
>
> <? include($_SERVER['DOCUMENT_ROOT'] . '/inc/header.inc.php') ?>
> <? include($_SERVER['DOCUMENT_ROOT'] . '/inc/menu.inc.php') ?>
> <? include($_SERVER['DOCUMENT_ROOT'] . '/inc/options.inc.php') ?>
> <? include($_SERVER['DOCUMENT_ROOT'] . '/inc/recommended.inc.php') ?>
>
> <div id=content>
>
>
> <h1><?=htmlspecialchars($title></h1>
>
> <? codigo('__plantilla.sql') ?>
>
> <p>Here comes content.</p>
>
> </div>
>
> <? include($_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php') ?>
>
> </body>
> </html>
>
>
>
>
>

Thanks Álvaro, this looks like EXACTLY what I was looking for. By the
way, what is the codigo() function used for ? (is it a spanish word or a
PHP keyword)?

Report this message

#12: Re: PHP newbie (generating HTML content in a generic way)- HOW ?

Posted on 2008-04-11 03:26:58 by gn501957

Ronald Raygun wrote:
>
>
> �lvaro G. Vicario wrote:
>> *** Ronald Raygun escribi�/wrote (Thu, 10 Apr 2008 17:35:09 +0100):
>>
>>> The problem is not how to write the script that generates the html
>>> (thats basically a case of using the echo statement), its how I can
>>> use those 'little blocks' in a single page - this will save me typing
>>> the same text over and over in my pages - and also reduce possibility
>>> of error, provide code resuse etc, etc...
>>
>>
>> If you mean blocks like headers, footers, navigation bars... I've always
>> kept them in individual files inside a directory called "inc" (for
>> "included files", since I insert them with the PHP include construct).
>> They're typically plain HTML with some PHP bits inside.
>>
>>
>> <div id="footer">
>> <p>&copy; 2008 by John Smith, generated on <?=date('d/m/y')?>,
>> blah blah</p>
>> <p>More blah blah.</p>
>> </div>
>>
>>
>> My site pages have a very basic skeleton (all design goes in *.css and
>> *.inc.php files):
>>
>>
>> <?
>>
>> $title = 'Template';
>>
>> require($_SERVER['DOCUMENT_ROOT'] . '/inc/config.inc.php');
>>
>> ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
>> "http://www.w3.org/TR/html4/strict.dtd">
>> <html lang="es">
>> <head><title>borrame.com &curren; <?=htmlspecialchars($title)?></title>
>> <? include($_SERVER['DOCUMENT_ROOT'] . '/inc/head.inc.php') ?>
>> <body>
>>
>> <? include($_SERVER['DOCUMENT_ROOT'] . '/inc/header.inc.php') ?>
>> <? include($_SERVER['DOCUMENT_ROOT'] . '/inc/menu.inc.php') ?>
>> <? include($_SERVER['DOCUMENT_ROOT'] . '/inc/options.inc.php') ?>
>> <? include($_SERVER['DOCUMENT_ROOT'] . '/inc/recommended.inc.php') ?>
>>
>> <div id=content>
>>
>>
>> <h1><?=htmlspecialchars($title></h1>
>>
>> <? codigo('__plantilla.sql') ?>
>>
>> <p>Here comes content.</p>
>>
>> </div>
>>
>> <? include($_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php') ?>
>>
>> </body>
>> </html>
>>
>>
>>
>>
>>
>
> Thanks �lvaro, this looks like EXACTLY what I was looking for. By the
> way, what is the codigo() function used for ? (is it a spanish word or a
> PHP keyword)?

Not to speak for the poster Vicario or anything here, but codigo() could
be a user-defined function defined in one of the many include()ed source
code files.... The parameter passed to the function is quite possibly a
reference to an SQL script to execute when the function is called....

...gk

Report this message

#13: Re: PHP newbie (generating HTML content in a generic way)- HOW ?

Posted on 2008-04-11 03:26:58 by gn501957

Ronald Raygun wrote:
>
>
> �lvaro G. Vicario wrote:
>> *** Ronald Raygun escribi�/wrote (Thu, 10 Apr 2008 17:35:09 +0100):
>>
>>> The problem is not how to write the script that generates the html
>>> (thats basically a case of using the echo statement), its how I can
>>> use those 'little blocks' in a single page - this will save me typing
>>> the same text over and over in my pages - and also reduce possibility
>>> of error, provide code resuse etc, etc...
>>
>>
>> If you mean blocks like headers, footers, navigation bars... I've always
>> kept them in individual files inside a directory called "inc" (for
>> "included files", since I insert them with the PHP include construct).
>> They're typically plain HTML with some PHP bits inside.
>>
>>
>> <div id="footer">
>> <p>&copy; 2008 by John Smith, generated on <?=date('d/m/y')?>,
>> blah blah</p>
>> <p>More blah blah.</p>
>> </div>
>>
>>
>> My site pages have a very basic skeleton (all design goes in *.css and
>> *.inc.php files):
>>
>>
>> <?
>>
>> $title = 'Template';
>>
>> require($_SERVER['DOCUMENT_ROOT'] . '/inc/config.inc.php');
>>
>> ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
>> "http://www.w3.org/TR/html4/strict.dtd">
>> <html lang="es">
>> <head><title>borrame.com &curren; <?=htmlspecialchars($title)?></title>
>> <? include($_SERVER['DOCUMENT_ROOT'] . '/inc/head.inc.php') ?>
>> <body>
>>
>> <? include($_SERVER['DOCUMENT_ROOT'] . '/inc/header.inc.php') ?>
>> <? include($_SERVER['DOCUMENT_ROOT'] . '/inc/menu.inc.php') ?>
>> <? include($_SERVER['DOCUMENT_ROOT'] . '/inc/options.inc.php') ?>
>> <? include($_SERVER['DOCUMENT_ROOT'] . '/inc/recommended.inc.php') ?>
>>
>> <div id=content>
>>
>>
>> <h1><?=htmlspecialchars($title></h1>
>>
>> <? codigo('__plantilla.sql') ?>
>>
>> <p>Here comes content.</p>
>>
>> </div>
>>
>> <? include($_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php') ?>
>>
>> </body>
>> </html>
>>
>>
>>
>>
>>
>
> Thanks �lvaro, this looks like EXACTLY what I was looking for. By the
> way, what is the codigo() function used for ? (is it a spanish word or a
> PHP keyword)?

Not to speak for the poster Vicario or anything here, but codigo() could
be a user-defined function defined in one of the many include()ed source
code files.... The parameter passed to the function is quite possibly a
reference to an SQL script to execute when the function is called....

...gk

Report this message

#14: Re: PHP newbie (generating HTML content in a generic way)- HOW ?

Posted on 2008-04-11 17:40:27 by webmasterNOSPAMTHANKS

*** Ronald Raygun escribió/wrote (Thu, 10 Apr 2008 22:45:17 +0100):
> Thanks Álvaro, this looks like EXACTLY what I was looking for. By the
> way, what is the codigo() function used for ? (is it a spanish word or a
> PHP keyword)?

It's a custom function I use in the site the sample comes from. I just
forgot to remove it <:-)


--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor en cubitos: http://www.demogracia.com
--

Report this message

#15: Re: PHP newbie (generating HTML content in a generic way)- HOW ?

Posted on 2008-04-11 17:40:27 by webmasterNOSPAMTHANKS

*** Ronald Raygun escribió/wrote (Thu, 10 Apr 2008 22:45:17 +0100):
> Thanks Álvaro, this looks like EXACTLY what I was looking for. By the
> way, what is the codigo() function used for ? (is it a spanish word or a
> PHP keyword)?

It's a custom function I use in the site the sample comes from. I just
forgot to remove it <:-)


--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor en cubitos: http://www.demogracia.com
--

Report this message

#16: Re: PHP newbie (generating HTML content in a generic way)- HOW ?

Posted on 2008-04-11 22:02:31 by kenoli

I do something similar. In addition, you can create functions and
call them at various points in the page to insert content of all sorts
along with appropriate html and tags, style attributes and
javascript. Using a master function with a switch operator, you can
vary the template, location of content in the page and other
variables. I actually found it was easier to set this up myself than
to learn Smarty, which looked like a challenge.

I'm really happy with what I have and can customize it to do exactly
what I want it to do.

--Kenoli

On Apr 11, 8:40=A0am, "=C1lvaro G. Vicario"
<webmasterNOSPAMTHA...@demogracia.com> wrote:
> *** Ronald Raygun escribi=F3/wrote (Thu, 10 Apr 2008 22:45:17 +0100):
>
> > Thanks =C1lvaro, this looks like EXACTLY what I was looking for. By the
> > way, what is the codigo() function used for ? (is it a spanish word or a=

> > PHP keyword)?
>
> It's a custom function I use in the site the sample comes from. I just
> forgot to remove it <:-)
>
> --
> --http://alvaro.es- =C1lvaro G. Vicario - Burgos, Spain
> -- Mi sitio sobre programaci=F3n web:http://bits.demogracia.com
> -- Mi web de humor en cubitos:http://www.demogracia.com
> --

Report this message

#17: Re: PHP newbie (generating HTML content in a generic way)- HOW ?

Posted on 2008-04-11 22:02:31 by kenoli

I do something similar. In addition, you can create functions and
call them at various points in the page to insert content of all sorts
along with appropriate html and tags, style attributes and
javascript. Using a master function with a switch operator, you can
vary the template, location of content in the page and other
variables. I actually found it was easier to set this up myself than
to learn Smarty, which looked like a challenge.

I'm really happy with what I have and can customize it to do exactly
what I want it to do.

--Kenoli

On Apr 11, 8:40=A0am, "=C1lvaro G. Vicario"
<webmasterNOSPAMTHA...@demogracia.com> wrote:
> *** Ronald Raygun escribi=F3/wrote (Thu, 10 Apr 2008 22:45:17 +0100):
>
> > Thanks =C1lvaro, this looks like EXACTLY what I was looking for. By the
> > way, what is the codigo() function used for ? (is it a spanish word or a=

> > PHP keyword)?
>
> It's a custom function I use in the site the sample comes from. I just
> forgot to remove it <:-)
>
> --
> --http://alvaro.es- =C1lvaro G. Vicario - Burgos, Spain
> -- Mi sitio sobre programaci=F3n web:http://bits.demogracia.com
> -- Mi web de humor en cubitos:http://www.demogracia.com
> --

Report this message

#18: Re: PHP newbie (generating HTML content in a generic way)- HOW ?

Posted on 2008-04-12 03:23:27 by Jerry Stuckle

kenoli wrote:
> On Apr 11, 8:40 am, "Álvaro G. Vicario"
> <webmasterNOSPAMTHA...@demogracia.com> wrote:
>> *** Ronald Raygun escribió/wrote (Thu, 10 Apr 2008 22:45:17 +0100):
>>
>>> Thanks Álvaro, this looks like EXACTLY what I was looking for. By the
>>> way, what is the codigo() function used for ? (is it a spanish word or a
>>> PHP keyword)?
>> It's a custom function I use in the site the sample comes from. I just
>> forgot to remove it <:-)
>>
>> --
>> --http://alvaro.es- Álvaro G. Vicario - Burgos, Spain
>> -- Mi sitio sobre programación web:http://bits.demogracia.com
>> -- Mi web de humor en cubitos:http://www.demogracia.com
>> --
>
>
> I do something similar. In addition, you can create functions and
> call them at various points in the page to insert content of all sorts
> along with appropriate html and tags, style attributes and
> javascript. Using a master function with a switch operator, you can
> vary the template, location of content in the page and other
> variables. I actually found it was easier to set this up myself than
> to learn Smarty, which looked like a challenge.
>
> I'm really happy with what I have and can customize it to do exactly
> what I want it to do.
>
> --Kenoli
>

(Top posting fixed)

Much better than using a switch() function is to use classes - or
different functions to do different things. Never have one function do
multiple things - like output different HTML based on a switch()
statement. It makes troubleshooting a nightmare.

P.S. Please don't top post. Thanks.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Report this message

#19: Re: PHP newbie (generating HTML content in a generic way)- HOW ?

Posted on 2008-04-12 03:23:27 by Jerry Stuckle

kenoli wrote:
> On Apr 11, 8:40 am, "Álvaro G. Vicario"
> <webmasterNOSPAMTHA...@demogracia.com> wrote:
>> *** Ronald Raygun escribió/wrote (Thu, 10 Apr 2008 22:45:17 +0100):
>>
>>> Thanks Álvaro, this looks like EXACTLY what I was looking for. By the
>>> way, what is the codigo() function used for ? (is it a spanish word or a
>>> PHP keyword)?
>> It's a custom function I use in the site the sample comes from. I just
>> forgot to remove it <:-)
>>
>> --
>> --http://alvaro.es- Álvaro G. Vicario - Burgos, Spain
>> -- Mi sitio sobre programación web:http://bits.demogracia.com
>> -- Mi web de humor en cubitos:http://www.demogracia.com
>> --
>
>
> I do something similar. In addition, you can create functions and
> call them at various points in the page to insert content of all sorts
> along with appropriate html and tags, style attributes and
> javascript. Using a master function with a switch operator, you can
> vary the template, location of content in the page and other
> variables. I actually found it was easier to set this up myself than
> to learn Smarty, which looked like a challenge.
>
> I'm really happy with what I have and can customize it to do exactly
> what I want it to do.
>
> --Kenoli
>

(Top posting fixed)

Much better than using a switch() function is to use classes - or
different functions to do different things. Never have one function do
multiple things - like output different HTML based on a switch()
statement. It makes troubleshooting a nightmare.

P.S. Please don't top post. Thanks.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Report this message

#20: Re: PHP newbie (generating HTML content in a generic way)- HOW ?

Posted on 2008-04-12 06:19:30 by kenoli

On Apr 11, 6:23=A0pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> kenoli wrote:
> > On Apr 11, 8:40 am, "=C1lvaro G. Vicario"
> > <webmasterNOSPAMTHA...@demogracia.com> wrote:
> >> *** Ronald Raygun escribi=F3/wrote (Thu, 10 Apr 2008 22:45:17 +0100):
>
> >>> Thanks =C1lvaro, this looks like EXACTLY what I was looking for. By th=
e
> >>> way, what is the codigo() function used for ? (is it a spanish word or=
a
> >>> PHP keyword)?
> >> It's a custom function I use in the site the sample comes from. I just
> >> forgot to remove it <:-)
>
> >> --
> >> --http://alvaro.es-=C1lvaro G. Vicario - Burgos, Spain
> >> -- Mi sitio sobre programaci=F3n web:http://bits.demogracia.com
> >> -- Mi web de humor en cubitos:http://www.demogracia.com
> >> --
>
> =A0> I do something similar. =A0In addition, you can create functions and
> =A0> call them at various points in the page to insert content of all sort=
s
> =A0> along with appropriate html and tags, style attributes and
> =A0> javascript. =A0Using a master function with a switch operator, you ca=
n
> =A0> vary the template, location of content in the page and other
> =A0> variables. =A0I actually found it was easier to set this up myself th=
an
> =A0> to learn Smarty, which looked like a challenge.
> =A0>
> =A0> I'm really happy with what I have and can customize it to do exactly
> =A0> what I want it to do.
> =A0>
> =A0> --Kenoli
> =A0>
>
> (Top posting fixed)
>
> Much better than using a switch() function is to use classes - or
> different functions to do different things. =A0Never have one function do
> multiple things - like output different HTML based on a switch()
> statement. =A0It makes troubleshooting a nightmare.
>
> P.S. Please don't top post. =A0Thanks.
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================

The usefulness of the switch operator for me is that based on a
particular field or combination of fields in a record it can select a
specific template, a specific page placement in a template, a
particular navigation function, data from a particular related table,
etc. As far as I can see, to do this kind of thing is going to
require some kind of conditional operator to select the appropriate
templates and functions and it seemed efficient to me to have it all
taken place in one location using a switch, and pretty easy to debug.
I'd be interested knowing more about the downside of this and
alternative constructs. Even using a class would require some kind of
switch like conditional within the class.

The way I am doing this is to send a get query to a php script in a
file that sets a series of variables based on what it receives
triggering a switch that selects the right template and functions
based on what it receives. It seemed pretty efficient and elegant to
me, though I am flying by the seat of my pants and a lot of non-
programmer intuition. I essentially have one script creating all the
pages in my site by connecting data through a set of functions applied
to a set of templates.

--Kenoli

Report this message

#21: Re: PHP newbie (generating HTML content in a generic way)- HOW ?

Posted on 2008-04-12 06:19:30 by kenoli

On Apr 11, 6:23=A0pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> kenoli wrote:
> > On Apr 11, 8:40 am, "=C1lvaro G. Vicario"
> > <webmasterNOSPAMTHA...@demogracia.com> wrote:
> >> *** Ronald Raygun escribi=F3/wrote (Thu, 10 Apr 2008 22:45:17 +0100):
>
> >>> Thanks =C1lvaro, this looks like EXACTLY what I was looking for. By th=
e
> >>> way, what is the codigo() function used for ? (is it a spanish word or=
a
> >>> PHP keyword)?
> >> It's a custom function I use in the site the sample comes from. I just
> >> forgot to remove it <:-)
>
> >> --
> >> --http://alvaro.es-=C1lvaro G. Vicario - Burgos, Spain
> >> -- Mi sitio sobre programaci=F3n web:http://bits.demogracia.com
> >> -- Mi web de humor en cubitos:http://www.demogracia.com
> >> --
>
> =A0> I do something similar. =A0In addition, you can create functions and
> =A0> call them at various points in the page to insert content of all sort=
s
> =A0> along with appropriate html and tags, style attributes and
> =A0> javascript. =A0Using a master function with a switch operator, you ca=
n
> =A0> vary the template, location of content in the page and other
> =A0> variables. =A0I actually found it was easier to set this up myself th=
an
> =A0> to learn Smarty, which looked like a challenge.
> =A0>
> =A0> I'm really happy with what I have and can customize it to do exactly
> =A0> what I want it to do.
> =A0>
> =A0> --Kenoli
> =A0>
>
> (Top posting fixed)
>
> Much better than using a switch() function is to use classes - or
> different functions to do different things. =A0Never have one function do
> multiple things - like output different HTML based on a switch()
> statement. =A0It makes troubleshooting a nightmare.
>
> P.S. Please don't top post. =A0Thanks.
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================

The usefulness of the switch operator for me is that based on a
particular field or combination of fields in a record it can select a
specific template, a specific page placement in a template, a
particular navigation function, data from a particular related table,
etc. As far as I can see, to do this kind of thing is going to
require some kind of conditional operator to select the appropriate
templates and functions and it seemed efficient to me to have it all
taken place in one location using a switch, and pretty easy to debug.
I'd be interested knowing more about the downside of this and
alternative constructs. Even using a class would require some kind of
switch like conditional within the class.

The way I am doing this is to send a get query to a php script in a
file that sets a series of variables based on what it receives
triggering a switch that selects the right template and functions
based on what it receives. It seemed pretty efficient and elegant to
me, though I am flying by the seat of my pants and a lot of non-
programmer intuition. I essentially have one script creating all the
pages in my site by connecting data through a set of functions applied
to a set of templates.

--Kenoli

Report this message

#22: Re: PHP newbie (generating HTML content in a generic way)- HOW ?

Posted on 2008-04-12 14:32:51 by Jerry Stuckle

kenoli wrote:
> On Apr 11, 6:23 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>> kenoli wrote:
>>> On Apr 11, 8:40 am, "Álvaro G. Vicario"
>>> <webmasterNOSPAMTHA...@demogracia.com> wrote:
>>>> *** Ronald Raygun escribió/wrote (Thu, 10 Apr 2008 22:45:17 +0100):
>>>>> Thanks Álvaro, this looks like EXACTLY what I was looking for. By the
>>>>> way, what is the codigo() function used for ? (is it a spanish word or a
>>>>> PHP keyword)?
>>>> It's a custom function I use in the site the sample comes from. I just
>>>> forgot to remove it <:-)
>>>> --
>>>> --http://alvaro.es-Álvaro G. Vicario - Burgos, Spain
>>>> -- Mi sitio sobre programación web:http://bits.demogracia.com
>>>> -- Mi web de humor en cubitos:http://www.demogracia.com
>>>> --
>> > I do something similar. In addition, you can create functions and
>> > call them at various points in the page to insert content of all sorts
>> > along with appropriate html and tags, style attributes and
>> > javascript. Using a master function with a switch operator, you can
>> > vary the template, location of content in the page and other
>> > variables. I actually found it was easier to set this up myself than
>> > to learn Smarty, which looked like a challenge.
>> >
>> > I'm really happy with what I have and can customize it to do exactly
>> > what I want it to do.
>> >
>> > --Kenoli
>> >
>>
>> (Top posting fixed)
>>
>> Much better than using a switch() function is to use classes - or
>> different functions to do different things. Never have one function do
>> multiple things - like output different HTML based on a switch()
>> statement. It makes troubleshooting a nightmare.
>>
>> P.S. Please don't top post. Thanks.
>> --
>> ==================
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstuck...@attglobal.net
>> ==================
>
> The usefulness of the switch operator for me is that based on a
> particular field or combination of fields in a record it can select a
> specific template, a specific page placement in a template, a
> particular navigation function, data from a particular related table,
> etc. As far as I can see, to do this kind of thing is going to
> require some kind of conditional operator to select the appropriate
> templates and functions and it seemed efficient to me to have it all
> taken place in one location using a switch, and pretty easy to debug.
> I'd be interested knowing more about the downside of this and
> alternative constructs. Even using a class would require some kind of
> switch like conditional within the class.
>
> The way I am doing this is to send a get query to a php script in a
> file that sets a series of variables based on what it receives
> triggering a switch that selects the right template and functions
> based on what it receives. It seemed pretty efficient and elegant to
> me, though I am flying by the seat of my pants and a lot of non-
> programmer intuition. I essentially have one script creating all the
> pages in my site by connecting data through a set of functions applied
> to a set of templates.
>
> --Kenoli
>

Which means anytime you need to add a new value or combination of
values, you need to redo your code. Data should never drive code.

But I'm not going to get into an argument with you as to why it's a bad
design. It sounds like you already have your mind made up.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Report this message

#23: Re: PHP newbie (generating HTML content in a generic way)- HOW ?

Posted on 2008-04-12 14:32:51 by Jerry Stuckle

kenoli wrote:
> On Apr 11, 6:23 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>> kenoli wrote:
>>> On Apr 11, 8:40 am, "Álvaro G. Vicario"
>>> <webmasterNOSPAMTHA...@demogracia.com> wrote:
>>>> *** Ronald Raygun escribió/wrote (Thu, 10 Apr 2008 22:45:17 +0100):
>>>>> Thanks Álvaro, this looks like EXACTLY what I was looking for. By the
>>>>> way, what is the codigo() function used for ? (is it a spanish word or a
>>>>> PHP keyword)?
>>>> It's a custom function I use in the site the sample comes from. I just
>>>> forgot to remove it <:-)
>>>> --
>>>> --http://alvaro.es-Álvaro G. Vicario - Burgos, Spain
>>>> -- Mi sitio sobre programación web:http://bits.demogracia.com
>>>> -- Mi web de humor en cubitos:http://www.demogracia.com
>>>> --
>> > I do something similar. In addition, you can create functions and
>> > call them at various points in the page to insert content of all sorts
>> > along with appropriate html and tags, style attributes and
>> > javascript. Using a master function with a switch operator, you can
>> > vary the template, location of content in the page and other
>> > variables. I actually found it was easier to set this up myself than
>> > to learn Smarty, which looked like a challenge.
>> >
>> > I'm really happy with what I have and can customize it to do exactly
>> > what I want it to do.
>> >
>> > --Kenoli
>> >
>>
>> (Top posting fixed)
>>
>> Much better than using a switch() function is to use classes - or
>> different functions to do different things. Never have one function do
>> multiple things - like output different HTML based on a switch()
>> statement. It makes troubleshooting a nightmare.
>>
>> P.S. Please don't top post. Thanks.
>> --
>> ==================
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstuck...@attglobal.net
>> ==================
>
> The usefulness of the switch operator for me is that based on a
> particular field or combination of fields in a record it can select a
> specific template, a specific page placement in a template, a
> particular navigation function, data from a particular related table,
> etc. As far as I can see, to do this kind of thing is going to
> require some kind of conditional operator to select the appropriate
> templates and functions and it seemed efficient to me to have it all
> taken place in one location using a switch, and pretty easy to debug.
> I'd be interested knowing more about the downside of this and
> alternative constructs. Even using a class would require some kind of
> switch like conditional within the class.
>
> The way I am doing this is to send a get query to a php script in a
> file that sets a series of variables based on what it receives
> triggering a switch that selects the right template and functions
> based on what it receives. It seemed pretty efficient and elegant to
> me, though I am flying by the seat of my pants and a lot of non-
> programmer intuition. I essentially have one script creating all the
> pages in my site by connecting data through a set of functions applied
> to a set of templates.
>
> --Kenoli
>

Which means anytime you need to add a new value or combination of
values, you need to redo your code. Data should never drive code.

But I'm not going to get into an argument with you as to why it's a bad
design. It sounds like you already have your mind made up.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Report this message

#24: Re: PHP newbie (generating HTML content in a generic way)- HOW ?

Posted on 2008-04-16 20:00:19 by unknown

Post removed (X-No-Archive: yes)

Report this message