Re: [PHP] Smarty Tips and Techniques

2009-03-20 Thread Virgilio Quilario
> Hi Virgil,
>
> After your last post here, I looked at your site, then the Smarty site.
> That was what triggered this question. Templates are a black art to me.
> I don't even know where to begin to understand them. Every reference I
> have looked at so far assumes that I already understand the MVC pattern,
> which is also one of the dark arts.
>
> Let me put it simply. I can't grok OO. I tried to do OOP for several
> years, but it simply does not make any sense to me. As a direct result,
> I don't understand the concept nor application of patterns. So how do I
> figure out how to use templates without having to absorb those first?
> Can I learn enough this way to determine if a site can be converted from
> the current state (PHP and XHTML spaghetti) into templates and begin
> that transformation?
>
> Thank you,
>
> Bob McConnell
>

HI Bob,

Smarty templates are just html files with placholders or variables and
simple constructs.
This was made to allow web designers to work on a page without having
to know PHP programming.
Smarty is not an MVC.
It is just a class that provides all the necessary functions to
replace variables and execute constructs in html page.
You just create an instance, set necessary config, do your PHP stuff,
assign values to template variables, and finally display.
It's just a matter of understanding how its functions or methods work.
You don't have to learn OOP and it is not about OOP or MVC.
It is just a convenient placeholder of functions necessary to run
smarty templates.

Spaghetti style programming can be very hard and really time consuming
to follow and convert.
Just take one step at a time.

Maybe I could write a tutorial for this.
Just need to find some spaghetti code for the  example.

Regards,
Virgil
http://www.jampmark.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Smarty Tips and Techniques

2009-03-20 Thread Thodoris



From: Bastien Koert
  

On Thu, Mar 19, 2009 at 11:06 AM, Bob McConnell  wrote:

From: Virgilio Quilario
>> That looks nice, but how do I get to the point where I can


understand
  

>> how to use it?
>>
>> I have also looked at the Smarty site


, but
  

>> their documents assume significant experience in building and


using
  

>> templates.
>>
>> Where can I find guidance or tutorials on how to do all of


this,
  

>> starting with only a rudimentary knowledge of HTML and PHP.


It would
  

be
>> best if they also focused on procedural rather than object


oriented
  

>> code.
>
>
> When I started learning smarty, I spent most of my time doing


research
  

> and that's really tiresome and it is so hard to find examples.
> Experimented a lot and listed those what's possible, then


applied them
  

> to my projects.
>
> Now to make them handy I posted them to my site so i can have


a look
  

> whenever and wherever.
>



http://www.jampmark.com/php-programming/16-very-useful-smarty-scripting-
  

tips-and-techniques-to-make-templates-smarter.html


 
  

>
> As a first step, maybe you should see the crash course at


smarty
  

> http://www.smarty.net/crashcourse.php

Hi Virgil,

After your last post here, I looked at your site, then the


Smarty site.
  

That was what triggered this question. Templates are a black art


to me.
  

I don't even know where to begin to understand them. Every


reference I
  

have looked at so far assumes that I already understand the MVC


pattern,
  

which is also one of the dark arts.

Let me put it simply. I can't grok OO. I tried to do OOP for


several
  

years, but it simply does not make any sense to me. As a direct


result,
  

I don't understand the concept nor application of patterns. So


how do I
  

figure out how to use templates without having to absorb those


first?
  

Can I learn enough this way to determine if a site can be


converted from
  

the current state (PHP and XHTML spaghetti) into templates and


begin
  

that transformation?

Bob,
 
You really would need to learn those concepts first OOP / MVC. There


is
  

 a learning curve, but you really don't need OOP to be able to do an


MVC
  
 style application, but it does make the code neater. 
 
One of the books that really helped me grok OOP is Head First


OOP...another
  
is Martin Fowlers Patterns of Enterprise Architecture. 


The MVC pattern is explained well in a number of places, but worth
 checking out are both the cakephp framework site and the codeingniter


site.
  
 
You'll find that there are people from both camps here, pure OOP and


other
  

just as happy with procedural coding styles. Many use both, using


objects
  

to handle common tasks like DB interaction or filesystem processes.



Yes, I have to deal with both camps here as well. Of five developers
doing PHP at the moment, two are primarily using OOP. But I spent 3.5
years as part of a team developing MS-Windows services in C++. After all
that time, I was only able to write basic functions for others to
convert into methods or classes. I could eventually find my way around
in some of those classes, but it seemed that every time I figured out
what was where, somebody "refactored" a major component and I had to
start all over again. All I saw was a lot of unnecessary overhead and
obfuscation which made little sense in the long run and slowed down both
the development and the application. The result was a handful of DLLs
that are shared between several products, and each time anything is
changed in one of them, every product needs to be retested to make sure
nothing got broke and some have to be recertified for PCI-DSS as well.

So you are telling me that I can forget about trying to use templates.
Since I can not understand OOP, there is no chance I will be able to use
them.

Just knowing that will probably save me several weeks of frustration.

Thank you,

Bob McConnell

  


Well think of the positive side that you don't need to write in OOP in 
order to use Smarty. Think it just like a class used for displaying the 
output (simply put).


At least I've been doing this for some time now (the non-OOP part).

I have a feeling that someone coming from the procedural way of 
programming would have problems probably with the templates instead of 
the development part.


--
Thodoris



RE: [PHP] Smarty Tips and Techniques

2009-03-20 Thread Robert Cummings
On Thu, 2009-03-19 at 22:54 -0400, Bob McConnell wrote:
> From: Robert Cummings
> >On Thu, 2009-03-19 at 12:14 -0400, Bob McConnell wrote:
> >> From: Bastien Koert
> >> > On Thu, Mar 19, 2009 at 11:06 AM, Bob McConnell 
> wrote:
> >> > 
> >> >  From: Virgilio Quilario
> 
> Most discussion clipped for brevity
> 
> > // OOP
> > 
> > class DbFireman extends DbPerson
> > {
> > private $fireman;
> > 
> > function DbPerson( $id )
> > {
> > parent::__constructor( $id );
> > $this->fireman = load_stuff_for_fireman_from_db();
> > }
> > 
> > function getStationId()
> > {
> > return $this->fireman['stationId'];
> > }
> > 
> > function setName( $name )
> > {
> > $this->fireman['stationId'] = $stationId;
> > }
> > }
> > 
> > $fireman = new DbFireman( 1234 );
> > $fireman->setStationId( 'Bob' );
> > echo $fireman->getStationId();
> > 
> > ?>
> > 
> > So as you can see they're almost identical except that the OOP version
> > of fireman didn't need to redeclare functions. True you could have
> > skipped doing that if you just used the person functions, but then you
> > may introduce onconsistencies. Additionally, the class version ensures
> > that the methods applied are those bleong to the concept of "fireman"
> > whereas passing data structures around can easily get confusing,
> > especially if you choose to allow the person functions to be applied
> to
> > the fireman. Going futher, using OOP let's you do all sorts of generic
> 
> Hi Rob,
> 
> Unfortunately, you still don't understand the problem I have. While it
> takes a while to puzzle out the details, I don't have any trouble
> reading, understanding or debugging code like this, even though you
> skipped completely over several major components (*). I have even
> modified existing methods and made minor adjustments to classes, _once
> they have been written_.
> 
> What I can't do is take a problem description and turn it into classes
> that will actually solve the problem. I can usually turn it into
> procedures relatively quickly. I can and have built real-time,
> multi-tasking and multi-threaded applications on a variety of kernels
> and operating systems with no significant trouble. I have written device
> drivers, interrupt service routines, message queues and I/O buffering
> routines without spending a lot of time thinking about them.

Aaah, you're stuck in procedural mode. In my first year of university
they taught us both C and Smalltalk in different courses and during the
same semester (same semester for me anyways). As such, I didn't form a
bias. Unfortunately they taught us scheme the following year and while I
understand scheme, I have less of a liking for it :)

> But defining objects and then figuring out how to create and use them
> completely escapes me. My mind simply won't map a problem into objects,
> it only sees procedures. Even when I look at classes, they resolve only
> as loose groupings of functions and variables, not as unified
> components.

And what is a library to you? And a library for which each function
requires on being passed a specific structure type? The structure is
merely the object, and the library routines are the methods. if you can
see libraries and structures, then you can see classes and methods.

> If anyone knows how to fix that, please tell me. In the meantime, in my
> continuing effort to eschew obfuscation, I will stick with procedural
> programming.

It's not for people to tell you how to fix it... it for you to unwire
your head and learn it yourself :)


> (*) For example, "$this->" suggests you have added an array of pointers.
> Some are pointers to functions (aka methods) others are pointers to
> variables (aka members). [--SNIPPITY--]
> 
> You also failed to explain what "new" does, or "parent::__constructor".
> What is the relationship between a class and an object? [--SNIPPITY--]

I wasn't teaching your OOP, I was showing that OOP and procedural are
merely different representations of the same thing, and that the
representations aren't all that different.

>  I get frustrated
> because of the extra overhead required to instantiate an object with its
> members before they can be referenced,

If you've done C programming then you know you have to instantiate a
pointer to a structure before you should access any of it's members.
Whether you zero out the memory or actually assign values... you are
still instantiating.

>  instead of simply being able to
> use them at any time from anywhere in my code. Likewise, having to pass
> a pointer for one object to another object before the second can call
> the first is also counter-intuitive. They're all part of the same
> application, why doesn't the compiler take care of those details like it
> should?

I'm not sure what you mean in the above.

> Obviously, I don't expect answers for these questions, but hopefully
> this will give you a better understanding of the greater issues
> involved. This is a

Re: [PHP] Smarty Tips and Techniques

2009-03-19 Thread Bipin Upadhyay

Bob McConnell wrote:

[SNIPPED]



the fireman. Going futher, using OOP let's you do all sorts of generic



Hi Rob,

Unfortunately, you still don't understand the problem I have. While it
takes a while to puzzle out the details, I don't have any trouble
reading, understanding or debugging code like this, even though you
skipped completely over several major components (*). I have even
modified existing methods and made minor adjustments to classes, _once
they have been written_.

What I can't do is take a problem description and turn it into classes
that will actually solve the problem. I can usually turn it into
procedures relatively quickly. I can and have built real-time,
multi-tasking and multi-threaded applications on a variety of kernels
and operating systems with no significant trouble. I have written device
drivers, interrupt service routines, message queues and I/O buffering
routines without spending a lot of time thinking about them.

But defining objects and then figuring out how to create and use them
completely escapes me. My mind simply won't map a problem into objects,
it only sees procedures. Even when I look at classes, they resolve only
as loose groupings of functions and variables, not as unified
components.

If anyone knows how to fix that, please tell me. In the meantime, in my
continuing effort to eschew obfuscation, I will stick with procedural
programming.

Bob McConnell

(*) For example, "$this->" suggests you have added an array of pointers.
Some are pointers to functions (aka methods) others are pointers to
variables (aka members). But there is no indication where this array
came from, what it means, nor how it affects the code structure. From
experience I know that "$this->" is not always needed, but the C++ rules
for when it is or isn't are neither clear nor consistent. There are no
declarations nor assignments for it. It simply adds another level of
obfuscated dereferencing that needs to be done in my head to understand
what is going on.

You also failed to explain what "new" does, or "parent::__constructor".
What is the relationship between a class and an object? I get frustrated
because of the extra overhead required to instantiate an object with its
members before they can be referenced, instead of simply being able to
use them at any time from anywhere in my code. Likewise, having to pass
a pointer for one object to another object before the second can call
the first is also counter-intuitive. They're all part of the same
application, why doesn't the compiler take care of those details like it
should?

  

Bob,

One of the best books that can help attain a practical understanding of 
OOP is "Head First Java". Please do not be eluded by "Java" in the title.
I'd sincerely encourage you to borrow "Head First Java" from someone, 
and then buy "Head First Object Oriented Analysis & Design".


You'll find answer to most of the questions raised by you, and in pretty 
interesting ways.

Obviously, I don't expect answers for these questions, but hopefully
this will give you a better understanding of the greater issues
involved. This is a far cry from the Fortran IV I was taught in college
40 years ago. B.M.

  

--
Regards,
Bipin Upadhyay.
http://projectbee.org/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Smarty Tips and Techniques

2009-03-19 Thread Michael A. Peters

Bob McConnell wrote:



But defining objects and then figuring out how to create and use them
completely escapes me. My mind simply won't map a problem into objects,
it only sees procedures. Even when I look at classes, they resolve only
as loose groupings of functions and variables, not as unified
components.

If anyone knows how to fix that, please tell me. In the meantime, in my
continuing effort to eschew obfuscation, I will stick with procedural
programming.


As an experienced programmer, please don't laugh too hard at my 
functions within my class - but maybe this will help you:


http://www.clfsrpm.net/xss/cspfilter_class.phps

Other than little piddly stuff (that is just as easily done as a 
function, first class I wrote.


A simplified example of it's usage -

http://www.clfsrpm.net/xss/index.phps

What it does is operate on a DOMDocument object.

I'm not really that fond of OO programming either, but in this case it 
made more sense to view the document to be filtered as objects (xml 
DOMDocument objects) because it made what the filter does much easier to 
program.


Since I was to be operated on object it made sense (to me anyway) to do 
it as a class instead of procedure functions.


However you will notice that all the class really is - is a bunch of 
variable definitions (some public, some private) and procedural 
functions. It's just that they operate only within the scope of the 
DOMDocument object they are told to operate on.


One thing to note - if a function has the same name as the class, it is 
a constructor and will be run when a new instance of the class is 
initiated and it MUST be a public function (why I don't understand, I'd 
prefer it if I could make it private yet still called when a new 
instance of a class is created).


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Smarty Tips and Techniques

2009-03-19 Thread Bob McConnell
From: Robert Cummings
>On Thu, 2009-03-19 at 12:14 -0400, Bob McConnell wrote:
>> From: Bastien Koert
>> > On Thu, Mar 19, 2009 at 11:06 AM, Bob McConnell 
wrote:
>> > 
>> >From: Virgilio Quilario

Most discussion clipped for brevity

> // OOP
> 
> class DbFireman extends DbPerson
> {
> private $fireman;
> 
> function DbPerson( $id )
> {
> parent::__constructor( $id );
> $this->fireman = load_stuff_for_fireman_from_db();
> }
> 
> function getStationId()
> {
> return $this->fireman['stationId'];
> }
> 
> function setName( $name )
> {
> $this->fireman['stationId'] = $stationId;
> }
> }
> 
> $fireman = new DbFireman( 1234 );
> $fireman->setStationId( 'Bob' );
> echo $fireman->getStationId();
> 
> ?>
> 
> So as you can see they're almost identical except that the OOP version
> of fireman didn't need to redeclare functions. True you could have
> skipped doing that if you just used the person functions, but then you
> may introduce onconsistencies. Additionally, the class version ensures
> that the methods applied are those bleong to the concept of "fireman"
> whereas passing data structures around can easily get confusing,
> especially if you choose to allow the person functions to be applied
to
> the fireman. Going futher, using OOP let's you do all sorts of generic

Hi Rob,

Unfortunately, you still don't understand the problem I have. While it
takes a while to puzzle out the details, I don't have any trouble
reading, understanding or debugging code like this, even though you
skipped completely over several major components (*). I have even
modified existing methods and made minor adjustments to classes, _once
they have been written_.

What I can't do is take a problem description and turn it into classes
that will actually solve the problem. I can usually turn it into
procedures relatively quickly. I can and have built real-time,
multi-tasking and multi-threaded applications on a variety of kernels
and operating systems with no significant trouble. I have written device
drivers, interrupt service routines, message queues and I/O buffering
routines without spending a lot of time thinking about them.

But defining objects and then figuring out how to create and use them
completely escapes me. My mind simply won't map a problem into objects,
it only sees procedures. Even when I look at classes, they resolve only
as loose groupings of functions and variables, not as unified
components.

If anyone knows how to fix that, please tell me. In the meantime, in my
continuing effort to eschew obfuscation, I will stick with procedural
programming.

Bob McConnell

(*) For example, "$this->" suggests you have added an array of pointers.
Some are pointers to functions (aka methods) others are pointers to
variables (aka members). But there is no indication where this array
came from, what it means, nor how it affects the code structure. From
experience I know that "$this->" is not always needed, but the C++ rules
for when it is or isn't are neither clear nor consistent. There are no
declarations nor assignments for it. It simply adds another level of
obfuscated dereferencing that needs to be done in my head to understand
what is going on.

You also failed to explain what "new" does, or "parent::__constructor".
What is the relationship between a class and an object? I get frustrated
because of the extra overhead required to instantiate an object with its
members before they can be referenced, instead of simply being able to
use them at any time from anywhere in my code. Likewise, having to pass
a pointer for one object to another object before the second can call
the first is also counter-intuitive. They're all part of the same
application, why doesn't the compiler take care of those details like it
should?

Obviously, I don't expect answers for these questions, but hopefully
this will give you a better understanding of the greater issues
involved. This is a far cry from the Fortran IV I was taught in college
40 years ago. B.M.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Smarty Tips and Techniques

2009-03-19 Thread Michael A. Peters

Robert Cummings wrote:

On Thu, 2009-03-19 at 18:05 -0700, Michael A. Peters wrote:

Robert Cummings wrote:

On Thu, 2009-03-19 at 16:27 -0700, Michael A. Peters wrote:

Marc Christopher Hall wrote:

The following comment is not intended to be helpful

*smacks head on desk repeatedly...*


This comment is..

I would hazard to say that if you are unwilling or unable to grasp OOP, MVCs
and any decent framework that is necessary then maybe stepping back and
tackling only things you can grasp.
To be honest - one of the problems is that documentation that tries to 
explain these concepts is often severely lacking, using extremely poor 
analogies, and only make sense to people who already have an 
understanding of the concept.


For example -

A car is a good real-world example of MVC. With a car you have two 
views: the interior and the exterior. Both take input from the 
controller: the driver. The brakes, steering wheel and other controls 
represent the model: they take input from the controller (driver) and 
hand them off to the views (interior/exterior) for presentation.


That's from a web page that is suppose to explain MVC.

I bet if you took 50 people who didn't have a clue as to what MVC is - 
maybe 1 or 2 of them would after reading that.


Documentation and howto's, just like code, really need to go through 
real world testing to see if they make sense to people not already 
familiar with the topic.


Unfortunately that rarely happens.

I think you have it back asswards. People need to go through real world
development or innane examples and then someone needs ot tell them where
they went wrong. That's how it worked in university. We got an example
like the one above, then we were expected to apply the principle. Those
who undertood it right away got great marks on their assignment, those
who took a little longer didn't... but if they kept at it... till they
figured it out... they got a good mark on the exam. I don't understand
defeatism. Suck it up! There's a zillion examples on the web. Study
many, learn the generalism.
The problem is I can make a car analogy out of any type of programming 
design method.


And some people can make a programming design method out of a car
analogy. Your point? Analogies are learning aids, not magic.

Most of those who got it right away and got great marks did so NOT 
because of what they learned from the example, but because of what they 
already knew before they signed up for the class.


You can't generalize that statement though. Many students don't know it
before they enter the class. And for those that did... they probably
learnt it from a trivial unrealistic example also.

Thus, when the teacher sees some of his students understanding the 
concept, he becomes smug and arrogant and thinks he did something right 
and those who didn't get it have something wrong with them. The reality 
is he can't teach worth shit and those who understood it did so before 
they took his class, hence he didn't teach them anything.


Once again, you can't generalize that statement. A bad experience with
one teacher can hardly convey a trait to all teachers.

Cheers,
Rob.


I'm not talking about a bad experience with a teacher.
I'm talking about the use of vague analogies that can be applied to 
anything and really only get the point across to someone already 
familiar with the concept.


It's a real problem in documentation, partly because the review, if any 
is done prior to publishing, is by someone else who already has at least 
a vague understanding of the concept.


IBM Developer documentation and Apple developer documentation (IMHO) 
tend to be better about this than most, but even with them it still is a 
real problem.


-=-

Speaking of Car Analogies - in my auto shop class way back when, they 
used a horse and buggy analogy to show that front wheel drive was 
better, because horses pull a cart, they don't push it.


I then asked where the power in a horse comes from - it's hind legs or 
it's front legs. The instructor was silent for a minute, then responded 
"I never thought about that, but you are absolutely right"


That's a serious problem with analogies, they always have serious 
problems that you can only ignore if you already understand the concept 
being portrayed by the analogy, and that's why I personally hate them. 
They seem to be quite popular, however, which is a shame.


Just document what the freakin' thing is - analogies just add confusion.

In the case of front wheel drive, the issue actually is engine location 
- not any horse and buggy crap. With front engines, power is lost down 
the long drive train to the rear wheels.


I bet the "automobile" concept of the a MVC has flaws just as big. A car 
isn't a MVC, it's a freakin' car, and other than the on-board computer 
that adds complexity and increases repair cost, programming method isn't 
part of the design.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.ne

Re: [PHP] Smarty Tips and Techniques

2009-03-19 Thread Robert Cummings
On Thu, 2009-03-19 at 18:05 -0700, Michael A. Peters wrote:
> Robert Cummings wrote:
> > On Thu, 2009-03-19 at 16:27 -0700, Michael A. Peters wrote:
> >> Marc Christopher Hall wrote:
> >>> The following comment is not intended to be helpful
> >>>
> >>> *smacks head on desk repeatedly...*
> >>>
> >>>
> >>> This comment is..
> >>>
> >>> I would hazard to say that if you are unwilling or unable to grasp OOP, 
> >>> MVCs
> >>> and any decent framework that is necessary then maybe stepping back and
> >>> tackling only things you can grasp.
> >> To be honest - one of the problems is that documentation that tries to 
> >> explain these concepts is often severely lacking, using extremely poor 
> >> analogies, and only make sense to people who already have an 
> >> understanding of the concept.
> >>
> >> For example -
> >>
> >> A car is a good real-world example of MVC. With a car you have two 
> >> views: the interior and the exterior. Both take input from the 
> >> controller: the driver. The brakes, steering wheel and other controls 
> >> represent the model: they take input from the controller (driver) and 
> >> hand them off to the views (interior/exterior) for presentation.
> >>
> >> That's from a web page that is suppose to explain MVC.
> >>
> >> I bet if you took 50 people who didn't have a clue as to what MVC is - 
> >> maybe 1 or 2 of them would after reading that.
> >>
> >> Documentation and howto's, just like code, really need to go through 
> >> real world testing to see if they make sense to people not already 
> >> familiar with the topic.
> >>
> >> Unfortunately that rarely happens.
> > 
> > I think you have it back asswards. People need to go through real world
> > development or innane examples and then someone needs ot tell them where
> > they went wrong. That's how it worked in university. We got an example
> > like the one above, then we were expected to apply the principle. Those
> > who undertood it right away got great marks on their assignment, those
> > who took a little longer didn't... but if they kept at it... till they
> > figured it out... they got a good mark on the exam. I don't understand
> > defeatism. Suck it up! There's a zillion examples on the web. Study
> > many, learn the generalism.
> 
> The problem is I can make a car analogy out of any type of programming 
> design method.

And some people can make a programming design method out of a car
analogy. Your point? Analogies are learning aids, not magic.

> Most of those who got it right away and got great marks did so NOT 
> because of what they learned from the example, but because of what they 
> already knew before they signed up for the class.

You can't generalize that statement though. Many students don't know it
before they enter the class. And for those that did... they probably
learnt it from a trivial unrealistic example also.

> Thus, when the teacher sees some of his students understanding the 
> concept, he becomes smug and arrogant and thinks he did something right 
> and those who didn't get it have something wrong with them. The reality 
> is he can't teach worth shit and those who understood it did so before 
> they took his class, hence he didn't teach them anything.

Once again, you can't generalize that statement. A bad experience with
one teacher can hardly convey a trait to all teachers.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Smarty Tips and Techniques

2009-03-19 Thread Michael A. Peters

Robert Cummings wrote:

On Thu, 2009-03-19 at 16:27 -0700, Michael A. Peters wrote:

Marc Christopher Hall wrote:

The following comment is not intended to be helpful

*smacks head on desk repeatedly...*


This comment is..

I would hazard to say that if you are unwilling or unable to grasp OOP, MVCs
and any decent framework that is necessary then maybe stepping back and
tackling only things you can grasp.
To be honest - one of the problems is that documentation that tries to 
explain these concepts is often severely lacking, using extremely poor 
analogies, and only make sense to people who already have an 
understanding of the concept.


For example -

A car is a good real-world example of MVC. With a car you have two 
views: the interior and the exterior. Both take input from the 
controller: the driver. The brakes, steering wheel and other controls 
represent the model: they take input from the controller (driver) and 
hand them off to the views (interior/exterior) for presentation.


That's from a web page that is suppose to explain MVC.

I bet if you took 50 people who didn't have a clue as to what MVC is - 
maybe 1 or 2 of them would after reading that.


Documentation and howto's, just like code, really need to go through 
real world testing to see if they make sense to people not already 
familiar with the topic.


Unfortunately that rarely happens.


I think you have it back asswards. People need to go through real world
development or innane examples and then someone needs ot tell them where
they went wrong. That's how it worked in university. We got an example
like the one above, then we were expected to apply the principle. Those
who undertood it right away got great marks on their assignment, those
who took a little longer didn't... but if they kept at it... till they
figured it out... they got a good mark on the exam. I don't understand
defeatism. Suck it up! There's a zillion examples on the web. Study
many, learn the generalism.


The problem is I can make a car analogy out of any type of programming 
design method.


Most of those who got it right away and got great marks did so NOT 
because of what they learned from the example, but because of what they 
already knew before they signed up for the class.


Thus, when the teacher sees some of his students understanding the 
concept, he becomes smug and arrogant and thinks he did something right 
and those who didn't get it have something wrong with them. The reality 
is he can't teach worth shit and those who understood it did so before 
they took his class, hence he didn't teach them anything.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Smarty Tips and Techniques

2009-03-19 Thread Robert Cummings
On Thu, 2009-03-19 at 16:27 -0700, Michael A. Peters wrote:
> Marc Christopher Hall wrote:
> > The following comment is not intended to be helpful
> > 
> > *smacks head on desk repeatedly...*
> > 
> > 
> > This comment is..
> > 
> > I would hazard to say that if you are unwilling or unable to grasp OOP, MVCs
> > and any decent framework that is necessary then maybe stepping back and
> > tackling only things you can grasp.
> 
> To be honest - one of the problems is that documentation that tries to 
> explain these concepts is often severely lacking, using extremely poor 
> analogies, and only make sense to people who already have an 
> understanding of the concept.
> 
> For example -
> 
> A car is a good real-world example of MVC. With a car you have two 
> views: the interior and the exterior. Both take input from the 
> controller: the driver. The brakes, steering wheel and other controls 
> represent the model: they take input from the controller (driver) and 
> hand them off to the views (interior/exterior) for presentation.
> 
> That's from a web page that is suppose to explain MVC.
> 
> I bet if you took 50 people who didn't have a clue as to what MVC is - 
> maybe 1 or 2 of them would after reading that.
> 
> Documentation and howto's, just like code, really need to go through 
> real world testing to see if they make sense to people not already 
> familiar with the topic.
> 
> Unfortunately that rarely happens.

I think you have it back asswards. People need to go through real world
development or innane examples and then someone needs ot tell them where
they went wrong. That's how it worked in university. We got an example
like the one above, then we were expected to apply the principle. Those
who undertood it right away got great marks on their assignment, those
who took a little longer didn't... but if they kept at it... till they
figured it out... they got a good mark on the exam. I don't understand
defeatism. Suck it up! There's a zillion examples on the web. Study
many, learn the generalism.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Smarty Tips and Techniques

2009-03-19 Thread Michael A. Peters

Marc Christopher Hall wrote:

The following comment is not intended to be helpful

*smacks head on desk repeatedly...*


This comment is..

I would hazard to say that if you are unwilling or unable to grasp OOP, MVCs
and any decent framework that is necessary then maybe stepping back and
tackling only things you can grasp.


To be honest - one of the problems is that documentation that tries to 
explain these concepts is often severely lacking, using extremely poor 
analogies, and only make sense to people who already have an 
understanding of the concept.


For example -

A car is a good real-world example of MVC. With a car you have two 
views: the interior and the exterior. Both take input from the 
controller: the driver. The brakes, steering wheel and other controls 
represent the model: they take input from the controller (driver) and 
hand them off to the views (interior/exterior) for presentation.


That's from a web page that is suppose to explain MVC.

I bet if you took 50 people who didn't have a clue as to what MVC is - 
maybe 1 or 2 of them would after reading that.


Documentation and howto's, just like code, really need to go through 
real world testing to see if they make sense to people not already 
familiar with the topic.


Unfortunately that rarely happens.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Smarty Tips and Techniques

2009-03-19 Thread Bob McConnell
From: Bastien Koert
> Just 162 files? I don't mean to sound condescending but if the code
> is that much trouble, chuck it out and start over.

Not going to happen. There are too many other tasks in the backlog that
are more important and will bring in real money as opposed to just
making the developers' lives easier. In addition, the current
application has already passed the PCI Level 1 audit, has been deployed
and is now handling a thousand transactions per day. If I can slip the
changes in piecemeal with those other tasks, fine, but starting over is
not even an option.

All three products combined are processing more than 10K transactions
per day. That spells success as far as management is concerned. With a
long list of client requested enhancements already assembled, code
maintenance issues are not even open for discussion.

Bob McConnell

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Smarty Tips and Techniques

2009-03-19 Thread Bastien Koert
On Thu, Mar 19, 2009 at 12:36 PM, Bob McConnell  wrote:

> From: Shawn McKenzie
>  > Bob McConnell wrote:
> >> From: Virgilio Quilario
>  That looks nice, but how do I get to the point where I can
> understand
>  how to use it?
> 
>  I have also looked at the Smarty site , but
>  their documents assume significant experience in building and using
>  templates.
> 
>  Where can I find guidance or tutorials on how to do all of this,
>  starting with only a rudimentary knowledge of HTML and PHP. It
> would
> >> be
>  best if they also focused on procedural rather than object oriented
>  code.
> >>>
> >>> When I started learning smarty, I spent most of my time doing
> research
> >>> and that's really tiresome and it is so hard to find examples.
> >>> Experimented a lot and listed those what's possible, then applied
> them
> >>> to my projects.
> >>>
> >>> Now to make them handy I posted them to my site so i can have a look
> >>> whenever and wherever.
> >>>
> >>
> http://www.jampmark.com/php-programming/16-very-useful-smarty-scripting-
> >> tips-and-techniques-to-make-templates-smarter.html
> >>> As a first step, maybe you should see the crash course at smarty
> >>> http://www.smarty.net/crashcourse.php
> >>
> >> Hi Virgil,
> >>
> >> After your last post here, I looked at your site, then the Smarty
> site.
> >> That was what triggered this question. Templates are a black art to
> me.
> >> I don't even know where to begin to understand them. Every reference
> I
> >> have looked at so far assumes that I already understand the MVC
> pattern,
> >> which is also one of the dark arts.
> >>
> >> Let me put it simply. I can't grok OO. I tried to do OOP for several
> >> years, but it simply does not make any sense to me. As a direct
> result,
> >> I don't understand the concept nor application of patterns. So how do
> I
> >> figure out how to use templates without having to absorb those first?
> >> Can I learn enough this way to determine if a site can be converted
> from
> >> the current state (PHP and XHTML spaghetti) into templates and begin
> >> that transformation?
> >
> > You don't need OOP to use templates.  Smarty is OOP. but there are
> some
> > lighter faster template solutions, as well as just creating your own
> > templates  that you either parse and replace vars in or just use PHP
> > code.  As long as you keep the PHP in your templates display oriented
> > and not business/app logic based then it should be a nice solution.
> >
> > You might also look at a framework (codeignitor, cakephp) and go
> through
> > their tutorial, though these are undoubtedly MVC/OOP, it may make more
> > sense once you start building something with it.
>
> Well, I installed CodeIgniter on one of my home servers last night, but
> have not yet started through the manual. That will be an interesting
> experiment. I am hoping to create a simple recipe management system
> there, similar to ReciPants, but in PHP.
>
> At work the problem is more basic; 162 files of interleaved database
> access, business logic and presentation, all written by a civil
> engineering student with no software training at all. He has moved on,
> but five of us working on three products are now dealing with the mess
> he left behind.
>
> Thank you,
>
> Bob McConnell
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Just 162 files? I don't mean to sound condescending but if the code is that
much trouble, chuck it out and start over. Build it properly by separating
out the db interaction stuff ( and there are great patterns to use there as
well like Active Record or work with an ORM layer like propel or doctrine ).
Then separate out the presentation layer, and define a transport to that
layer from the business logic layer. I like XML for this, passing it to XSLT
for client side transformations into html. Then the DB passes to the
business layer, which does its stuff and then passes the results to the
presentation layer. And the same in reverse, the presentation layer never
talks to the db layer directly.

Creating that separation should make the whole maintenance issue better.
Parts that need to be shared can be copied across to the other applications
so that each app lives in isolation. If that is not possible, the consider
breaking the shared bits into smaller pieces to limit the exposure to
potential issues when you have to make changes. PCI is a pain in the ass and
the rules that govern that make things very difficult, though I can see why
it all needs to be there.

The application I support (classic ASP) comprises 149 Mb of code in some
1500 + files scattered across some 50+ folders each with their own db access
code. Nightmare isn't the word for it. It uses some 160+ DB tables as well.
Rebuilding it is a task that I am looking forward to and am definitely using
the MVC pattern with OOP to some extent. I am looking at codeig

RE: [PHP] Smarty Tips and Techniques

2009-03-19 Thread Robert Cummings
On Thu, 2009-03-19 at 12:14 -0400, Bob McConnell wrote:
> From: Bastien Koert
> > On Thu, Mar 19, 2009 at 11:06 AM, Bob McConnell  wrote:
> > 
> > From: Virgilio Quilario
> > >> That looks nice, but how do I get to the point where I can
> understand
> > >> how to use it?
> > >>
> > >> I have also looked at the Smarty site
> , but
> > >> their documents assume significant experience in building and
> using
> > >> templates.
> > >>
> > >> Where can I find guidance or tutorials on how to do all of
> this,
> > >> starting with only a rudimentary knowledge of HTML and PHP.
> It would
> > be
> > >> best if they also focused on procedural rather than object
> oriented
> > >> code.
> > >
> > >
> > > When I started learning smarty, I spent most of my time doing
> research
> > > and that's really tiresome and it is so hard to find examples.
> > > Experimented a lot and listed those what's possible, then
> applied them
> > > to my projects.
> > >
> > > Now to make them handy I posted them to my site so i can have
> a look
> > > whenever and wherever.
> > >
> >
> http://www.jampmark.com/php-programming/16-very-useful-smarty-scripting-
> > tips-and-techniques-to-make-templates-smarter.html
>  -tips-and-techniques-to-make-templates-smarter.html> 
> > >
> > > As a first step, maybe you should see the crash course at
> smarty
> > > http://www.smarty.net/crashcourse.php
> > 
> > Hi Virgil,
> > 
> > After your last post here, I looked at your site, then the
> Smarty site.
> > That was what triggered this question. Templates are a black art
> to me.
> > I don't even know where to begin to understand them. Every
> reference I
> > have looked at so far assumes that I already understand the MVC
> pattern,
> > which is also one of the dark arts.
> > 
> > Let me put it simply. I can't grok OO. I tried to do OOP for
> several
> > years, but it simply does not make any sense to me. As a direct
> result,
> > I don't understand the concept nor application of patterns. So
> how do I
> > figure out how to use templates without having to absorb those
> first?
> > Can I learn enough this way to determine if a site can be
> converted from
> > the current state (PHP and XHTML spaghetti) into templates and
> begin
> > that transformation?
> > 
> > Bob,
> >  
> > You really would need to learn those concepts first OOP / MVC. There
> is
> >  a learning curve, but you really don't need OOP to be able to do an
> MVC
> >  style application, but it does make the code neater. 
> >  
> > One of the books that really helped me grok OOP is Head First
> OOP...another
> > is Martin Fowlers Patterns of Enterprise Architecture. 
> > 
> > The MVC pattern is explained well in a number of places, but worth
> >  checking out are both the cakephp framework site and the codeingniter
> site.
> >  
> > You'll find that there are people from both camps here, pure OOP and
> other
> > just as happy with procedural coding styles. Many use both, using
> objects
> > to handle common tasks like DB interaction or filesystem processes.
> 
> Yes, I have to deal with both camps here as well. Of five developers
> doing PHP at the moment, two are primarily using OOP. But I spent 3.5
> years as part of a team developing MS-Windows services in C++. After all
> that time, I was only able to write basic functions for others to
> convert into methods or classes. I could eventually find my way around
> in some of those classes, but it seemed that every time I figured out
> what was where, somebody "refactored" a major component and I had to
> start all over again. All I saw was a lot of unnecessary overhead and
> obfuscation which made little sense in the long run and slowed down both
> the development and the application. The result was a handful of DLLs
> that are shared between several products, and each time anything is
> changed in one of them, every product needs to be retested to make sure
> nothing got broke and some have to be recertified for PCI-DSS as well.
> 
> So you are telling me that I can forget about trying to use templates.
> Since I can not understand OOP, there is no chance I will be able to use
> them.
> 
> Just knowing that will probably save me several weeks of frustration.

OOP for those having trouble:



name;
}

function setName( $name )
{
$this->name = $name;
}
}

$person = new DbPerson( 1234 );
$person->setName( 'Bob' );
echo $person->getName();

?>

So from the above you can see that the two translate quite cleanly
between one another. We merely change passing the structure to function
to a case of calling the functions on the structure itself. Now, where
does OOP make more sense?



fireman = load_stuff_for_fireman_from_db();
}

function getStationId()

Re: [PHP] Smarty Tips and Techniques

2009-03-19 Thread Shawn McKenzie
Bob McConnell wrote:
> From: Virgilio Quilario
>>> That looks nice, but how do I get to the point where I can understand
>>> how to use it?
>>>
>>> I have also looked at the Smarty site , but
>>> their documents assume significant experience in building and using
>>> templates.
>>>
>>> Where can I find guidance or tutorials on how to do all of this,
>>> starting with only a rudimentary knowledge of HTML and PHP. It would
> be
>>> best if they also focused on procedural rather than object oriented
>>> code.
>>
>> When I started learning smarty, I spent most of my time doing research
>> and that's really tiresome and it is so hard to find examples.
>> Experimented a lot and listed those what's possible, then applied them
>> to my projects.
>>
>> Now to make them handy I posted them to my site so i can have a look
>> whenever and wherever.
>>
> http://www.jampmark.com/php-programming/16-very-useful-smarty-scripting-
> tips-and-techniques-to-make-templates-smarter.html
>> As a first step, maybe you should see the crash course at smarty
>> http://www.smarty.net/crashcourse.php
> 
> Hi Virgil,
> 
> After your last post here, I looked at your site, then the Smarty site.
> That was what triggered this question. Templates are a black art to me.
> I don't even know where to begin to understand them. Every reference I
> have looked at so far assumes that I already understand the MVC pattern,
> which is also one of the dark arts.
> 
> Let me put it simply. I can't grok OO. I tried to do OOP for several
> years, but it simply does not make any sense to me. As a direct result,
> I don't understand the concept nor application of patterns. So how do I
> figure out how to use templates without having to absorb those first?
> Can I learn enough this way to determine if a site can be converted from
> the current state (PHP and XHTML spaghetti) into templates and begin
> that transformation?
> 
> Thank you,
> 
> Bob McConnell

You don't need OOP to use templates.  Smarty is OOP. but there are some
lighter faster template solutions, as well as just creating your own
templates  that you either parse and replace vars in or just use PHP
code.  As long as you keep the PHP in your templates display oriented
and not business/app logic based then it should be a nice solution.

You might also look at a framework (codeignitor, cakephp) and go through
their tutorial, though these are undoubtedly MVC/OOP, it may make more
sense once you start building something with it.

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Smarty Tips and Techniques

2009-03-19 Thread Bob McConnell
From: Shawn McKenzie
> Bob McConnell wrote:
>> From: Virgilio Quilario
 That looks nice, but how do I get to the point where I can
understand
 how to use it?

 I have also looked at the Smarty site , but
 their documents assume significant experience in building and using
 templates.

 Where can I find guidance or tutorials on how to do all of this,
 starting with only a rudimentary knowledge of HTML and PHP. It
would
>> be
 best if they also focused on procedural rather than object oriented
 code.
>>>
>>> When I started learning smarty, I spent most of my time doing
research
>>> and that's really tiresome and it is so hard to find examples.
>>> Experimented a lot and listed those what's possible, then applied
them
>>> to my projects.
>>>
>>> Now to make them handy I posted them to my site so i can have a look
>>> whenever and wherever.
>>>
>>
http://www.jampmark.com/php-programming/16-very-useful-smarty-scripting-
>> tips-and-techniques-to-make-templates-smarter.html
>>> As a first step, maybe you should see the crash course at smarty
>>> http://www.smarty.net/crashcourse.php
>> 
>> Hi Virgil,
>> 
>> After your last post here, I looked at your site, then the Smarty
site.
>> That was what triggered this question. Templates are a black art to
me.
>> I don't even know where to begin to understand them. Every reference
I
>> have looked at so far assumes that I already understand the MVC
pattern,
>> which is also one of the dark arts.
>> 
>> Let me put it simply. I can't grok OO. I tried to do OOP for several
>> years, but it simply does not make any sense to me. As a direct
result,
>> I don't understand the concept nor application of patterns. So how do
I
>> figure out how to use templates without having to absorb those first?
>> Can I learn enough this way to determine if a site can be converted
from
>> the current state (PHP and XHTML spaghetti) into templates and begin
>> that transformation?
> 
> You don't need OOP to use templates.  Smarty is OOP. but there are
some
> lighter faster template solutions, as well as just creating your own
> templates  that you either parse and replace vars in or just use PHP
> code.  As long as you keep the PHP in your templates display oriented
> and not business/app logic based then it should be a nice solution.
> 
> You might also look at a framework (codeignitor, cakephp) and go
through
> their tutorial, though these are undoubtedly MVC/OOP, it may make more
> sense once you start building something with it.

Well, I installed CodeIgniter on one of my home servers last night, but
have not yet started through the manual. That will be an interesting
experiment. I am hoping to create a simple recipe management system
there, similar to ReciPants, but in PHP.

At work the problem is more basic; 162 files of interleaved database
access, business logic and presentation, all written by a civil
engineering student with no software training at all. He has moved on,
but five of us working on three products are now dealing with the mess
he left behind.

Thank you,

Bob McConnell

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Smarty Tips and Techniques

2009-03-19 Thread Bob McConnell
From: Bastien Koert
> On Thu, Mar 19, 2009 at 11:06 AM, Bob McConnell  wrote:
> 
>   From: Virgilio Quilario
>   >> That looks nice, but how do I get to the point where I can
understand
>   >> how to use it?
>   >>
>   >> I have also looked at the Smarty site
, but
>   >> their documents assume significant experience in building and
using
>   >> templates.
>   >>
>   >> Where can I find guidance or tutorials on how to do all of
this,
>   >> starting with only a rudimentary knowledge of HTML and PHP.
It would
>   be
>   >> best if they also focused on procedural rather than object
oriented
>   >> code.
>   >
>   >
>   > When I started learning smarty, I spent most of my time doing
research
>   > and that's really tiresome and it is so hard to find examples.
>   > Experimented a lot and listed those what's possible, then
applied them
>   > to my projects.
>   >
>   > Now to make them handy I posted them to my site so i can have
a look
>   > whenever and wherever.
>   >
>
http://www.jampmark.com/php-programming/16-very-useful-smarty-scripting-
>   tips-and-techniques-to-make-templates-smarter.html
 
>   >
>   > As a first step, maybe you should see the crash course at
smarty
>   > http://www.smarty.net/crashcourse.php
>   
>   Hi Virgil,
>   
>   After your last post here, I looked at your site, then the
Smarty site.
>   That was what triggered this question. Templates are a black art
to me.
>   I don't even know where to begin to understand them. Every
reference I
>   have looked at so far assumes that I already understand the MVC
pattern,
>   which is also one of the dark arts.
>   
>   Let me put it simply. I can't grok OO. I tried to do OOP for
several
>   years, but it simply does not make any sense to me. As a direct
result,
>   I don't understand the concept nor application of patterns. So
how do I
>   figure out how to use templates without having to absorb those
first?
>   Can I learn enough this way to determine if a site can be
converted from
>   the current state (PHP and XHTML spaghetti) into templates and
begin
>   that transformation?
> 
> Bob,
>  
> You really would need to learn those concepts first OOP / MVC. There
is
>  a learning curve, but you really don't need OOP to be able to do an
MVC
>  style application, but it does make the code neater. 
>  
> One of the books that really helped me grok OOP is Head First
OOP...another
> is Martin Fowlers Patterns of Enterprise Architecture. 
> 
> The MVC pattern is explained well in a number of places, but worth
>  checking out are both the cakephp framework site and the codeingniter
site.
>  
> You'll find that there are people from both camps here, pure OOP and
other
> just as happy with procedural coding styles. Many use both, using
objects
> to handle common tasks like DB interaction or filesystem processes.

Yes, I have to deal with both camps here as well. Of five developers
doing PHP at the moment, two are primarily using OOP. But I spent 3.5
years as part of a team developing MS-Windows services in C++. After all
that time, I was only able to write basic functions for others to
convert into methods or classes. I could eventually find my way around
in some of those classes, but it seemed that every time I figured out
what was where, somebody "refactored" a major component and I had to
start all over again. All I saw was a lot of unnecessary overhead and
obfuscation which made little sense in the long run and slowed down both
the development and the application. The result was a handful of DLLs
that are shared between several products, and each time anything is
changed in one of them, every product needs to be retested to make sure
nothing got broke and some have to be recertified for PCI-DSS as well.

So you are telling me that I can forget about trying to use templates.
Since I can not understand OOP, there is no chance I will be able to use
them.

Just knowing that will probably save me several weeks of frustration.

Thank you,

Bob McConnell

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Smarty Tips and Techniques

2009-03-19 Thread Marc Christopher Hall
The following comment is not intended to be helpful

*smacks head on desk repeatedly...*


This comment is..

I would hazard to say that if you are unwilling or unable to grasp OOP, MVCs
and any decent framework that is necessary then maybe stepping back and
tackling only things you can grasp. I do not mean to come across
condescending and I apologize if I have anyway; however, I do not see an
alternative solution for you. Stick to what you are comfortable with and
think about outsourcing the OOP to someone you can trust to write decent
code.





-Original Message-
From: Bob McConnell [mailto:r...@cbord.com] 
Sent: Thursday, March 19, 2009 11:06 AM
To: Virgilio Quilario
Cc: php-general@lists.php.net
Subject: RE: [PHP] Smarty Tips and Techniques

From: Virgilio Quilario
>> That looks nice, but how do I get to the point where I can understand
>> how to use it?
>>
>> I have also looked at the Smarty site <http://www.smarty.net/>, but
>> their documents assume significant experience in building and using
>> templates.
>>
>> Where can I find guidance or tutorials on how to do all of this,
>> starting with only a rudimentary knowledge of HTML and PHP. It would
be
>> best if they also focused on procedural rather than object oriented
>> code.
> 
> 
> When I started learning smarty, I spent most of my time doing research
> and that's really tiresome and it is so hard to find examples.
> Experimented a lot and listed those what's possible, then applied them
> to my projects.
> 
> Now to make them handy I posted them to my site so i can have a look
> whenever and wherever.
>
http://www.jampmark.com/php-programming/16-very-useful-smarty-scripting-
tips-and-techniques-to-make-templates-smarter.html
> 
> As a first step, maybe you should see the crash course at smarty
> http://www.smarty.net/crashcourse.php

Hi Virgil,

After your last post here, I looked at your site, then the Smarty site.
That was what triggered this question. Templates are a black art to me.
I don't even know where to begin to understand them. Every reference I
have looked at so far assumes that I already understand the MVC pattern,
which is also one of the dark arts.

Let me put it simply. I can't grok OO. I tried to do OOP for several
years, but it simply does not make any sense to me. As a direct result,
I don't understand the concept nor application of patterns. So how do I
figure out how to use templates without having to absorb those first?
Can I learn enough this way to determine if a site can be converted from
the current state (PHP and XHTML spaghetti) into templates and begin
that transformation?

Thank you,

Bob McConnell

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


__ Information from ESET Smart Security, version of virus signature
database 3948 (20090319) __

The message was checked by ESET Smart Security.

http://www.eset.com


 

__ Information from ESET Smart Security, version of virus signature
database 3948 (20090319) __

The message was checked by ESET Smart Security.

http://www.eset.com
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Smarty Tips and Techniques

2009-03-19 Thread Bastien Koert
On Thu, Mar 19, 2009 at 11:06 AM, Bob McConnell  wrote:

> From: Virgilio Quilario
> >> That looks nice, but how do I get to the point where I can understand
> >> how to use it?
> >>
> >> I have also looked at the Smarty site , but
> >> their documents assume significant experience in building and using
> >> templates.
> >>
> >> Where can I find guidance or tutorials on how to do all of this,
> >> starting with only a rudimentary knowledge of HTML and PHP. It would
> be
> >> best if they also focused on procedural rather than object oriented
> >> code.
> >
> >
> > When I started learning smarty, I spent most of my time doing research
> > and that's really tiresome and it is so hard to find examples.
> > Experimented a lot and listed those what's possible, then applied them
> > to my projects.
> >
> > Now to make them handy I posted them to my site so i can have a look
> > whenever and wherever.
> >
> http://www.jampmark.com/php-programming/16-very-useful-smarty-scripting-
> tips-and-techniques-to-make-templates-smarter.html
> >
> > As a first step, maybe you should see the crash course at smarty
> > http://www.smarty.net/crashcourse.php
>
> Hi Virgil,
>
> After your last post here, I looked at your site, then the Smarty site.
> That was what triggered this question. Templates are a black art to me.
> I don't even know where to begin to understand them. Every reference I
> have looked at so far assumes that I already understand the MVC pattern,
> which is also one of the dark arts.
>
> Let me put it simply. I can't grok OO. I tried to do OOP for several
> years, but it simply does not make any sense to me. As a direct result,
> I don't understand the concept nor application of patterns. So how do I
> figure out how to use templates without having to absorb those first?
> Can I learn enough this way to determine if a site can be converted from
> the current state (PHP and XHTML spaghetti) into templates and begin
> that transformation?
>
> Thank you,
>
> Bob McConnell
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Bob,

You really would need to learn those concepts first OOP / MVC. There is a
learning curve, but you really don't need OOP to be able to do an MVC style
application, but it does make the code neater.

One of the books that really helped me grok OOP is Head First OOP...another
is Martin Fowlers Patterns of Enterprise Architecture.

The MVC pattern is explained well in a number of places, but worth checking
out are both the cakephp framework site and the codeingniter site.

You'll find that there are people from both camps here, pure OOP and other
just as happy with procedural coding styles. Many use both, using objects to
handle common tasks like DB interaction or filesystem processes.

-- 

Bastien

Cat, the other other white meat


RE: [PHP] Smarty Tips and Techniques

2009-03-19 Thread Bob McConnell
From: Virgilio Quilario
>> That looks nice, but how do I get to the point where I can understand
>> how to use it?
>>
>> I have also looked at the Smarty site , but
>> their documents assume significant experience in building and using
>> templates.
>>
>> Where can I find guidance or tutorials on how to do all of this,
>> starting with only a rudimentary knowledge of HTML and PHP. It would
be
>> best if they also focused on procedural rather than object oriented
>> code.
> 
> 
> When I started learning smarty, I spent most of my time doing research
> and that's really tiresome and it is so hard to find examples.
> Experimented a lot and listed those what's possible, then applied them
> to my projects.
> 
> Now to make them handy I posted them to my site so i can have a look
> whenever and wherever.
>
http://www.jampmark.com/php-programming/16-very-useful-smarty-scripting-
tips-and-techniques-to-make-templates-smarter.html
> 
> As a first step, maybe you should see the crash course at smarty
> http://www.smarty.net/crashcourse.php

Hi Virgil,

After your last post here, I looked at your site, then the Smarty site.
That was what triggered this question. Templates are a black art to me.
I don't even know where to begin to understand them. Every reference I
have looked at so far assumes that I already understand the MVC pattern,
which is also one of the dark arts.

Let me put it simply. I can't grok OO. I tried to do OOP for several
years, but it simply does not make any sense to me. As a direct result,
I don't understand the concept nor application of patterns. So how do I
figure out how to use templates without having to absorb those first?
Can I learn enough this way to determine if a site can be converted from
the current state (PHP and XHTML spaghetti) into templates and begin
that transformation?

Thank you,

Bob McConnell

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Smarty Tips and Techniques

2009-03-19 Thread Virgilio Quilario
> That looks nice, but how do I get to the point where I can understand
> how to use it?
>
> I have also looked at the Smarty site , but
> their documents assume significant experience in building and using
> templates.
>
> Where can I find guidance or tutorials on how to do all of this,
> starting with only a rudimentary knowledge of HTML and PHP. It would be
> best if they also focused on procedural rather than object oriented
> code.
>
> Bob McConnell
>

When I started learning smarty, I spent most of my time doing research
and that's really tiresome and it is so hard to find examples.
Experimented a lot and listed those what's possible, then applied them
to my projects.

Now to make them handy I posted them to my site so i can have a look
whenever and wherever.
http://www.jampmark.com/php-programming/16-very-useful-smarty-scripting-tips-and-techniques-to-make-templates-smarter.html

As a first step, maybe you should see the crash course at smarty
http://www.smarty.net/crashcourse.php

Virgil
http://www.jampmark.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Smarty Tips and Techniques

2009-03-18 Thread Thodoris



That looks nice, but how do I get to the point where I can understand
how to use it?

I have also looked at the Smarty site <http://www.smarty.net/>, but
their documents assume significant experience in building and using
templates.

Where can I find guidance or tutorials on how to do all of this,
starting with only a rudimentary knowledge of HTML and PHP. It would be
best if they also focused on procedural rather than object oriented
code.

Bob McConnell

-Original Message-
From: Virgilio Quilario [mailto:virgilio.quila...@gmail.com] 
Sent: Wednesday, March 18, 2009 10:36 AM

To: php-general@lists.php.net
Subject: [PHP] Smarty Tips and Techniques

Hi list,

Just wanna share my collection of Smarty scripting tips and techniques.
Smarty is a template engine for PHP that you can use to separate data
and logic from web design.
This way programmers can work on the php scripts and designers can
work on the templates for the same web site.

Here is the link:
http://www.jampmark.com/php-programming/16-very-useful-smarty-scripting-
tips-and-techniques-to-make-templates-smarter.html

Hope you find it useful.

Virgil

  


I have stared using smarty myself in a recent project I am still making 
and I'll have to say that it has its virtues.


Look at a simple example in the smarty's site and use the manual for any 
questions. You will probably find some stuff by googling.


The templates (simply put) are actually html-like that has some php 
variables inside you may assign before displaying the actual template.

This way you customize the template to output what you need.

Above that you may start using the statements to automatically build 
forms, tables etc


I like the fact that there is a cache and that the templates get 
"compiled" which make them faster to process.


Nevertheless you need time to get familiar with the smarty way of 
thinking as with all frameworks and template engines you need to use.


--
Thodoris


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Smarty Tips and Techniques

2009-03-18 Thread Bob McConnell
That looks nice, but how do I get to the point where I can understand
how to use it?

I have also looked at the Smarty site <http://www.smarty.net/>, but
their documents assume significant experience in building and using
templates.

Where can I find guidance or tutorials on how to do all of this,
starting with only a rudimentary knowledge of HTML and PHP. It would be
best if they also focused on procedural rather than object oriented
code.

Bob McConnell

-Original Message-
From: Virgilio Quilario [mailto:virgilio.quila...@gmail.com] 
Sent: Wednesday, March 18, 2009 10:36 AM
To: php-general@lists.php.net
Subject: [PHP] Smarty Tips and Techniques

Hi list,

Just wanna share my collection of Smarty scripting tips and techniques.
Smarty is a template engine for PHP that you can use to separate data
and logic from web design.
This way programmers can work on the php scripts and designers can
work on the templates for the same web site.

Here is the link:
http://www.jampmark.com/php-programming/16-very-useful-smarty-scripting-
tips-and-techniques-to-make-templates-smarter.html

Hope you find it useful.

Virgil

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Smarty Tips and Techniques

2009-03-18 Thread Virgilio Quilario
Hi list,

Just wanna share my collection of Smarty scripting tips and techniques.
Smarty is a template engine for PHP that you can use to separate data
and logic from web design.
This way programmers can work on the php scripts and designers can
work on the templates for the same web site.

Here is the link:
http://www.jampmark.com/php-programming/16-very-useful-smarty-scripting-tips-and-techniques-to-make-templates-smarter.html

Hope you find it useful.

Virgil

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php