PHP Method ?

There are many different ways to "construct" the page by thi

Page 1 of 1

6 Replies - 642 Views - Last Post: 14 July 2009 - 03:23 PM Rate Topic: -----

#1 im@geek  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 94
  • Joined: 18-February 05

PHP Method ?

Post icon  Posted 13 July 2009 - 01:01 PM

Hi everybody,

Generally speaking, the best way I learn any programming languages is to de-construct existing code. I'm sure this is quite common. Lately I have had a need to learn PHP. So far as always it has been very fun!!! I have been looking at alot of websites and web apps and have notice that there are many different ways to "construct" the page by this I mean the dynamic building blocks of a relatively simple to very complex sites. I have if you look at the demo face book web app and compare it to say... Pligg, Drupal, Webpress, etc.. including othr hand built sites, the all have there own equally impressive ways to render the "page".

I have two Questions:

1. Is there a specific term for what i am trying to describe?
2. (loaded ?) Is there a preferred "Method"

Hope this is clear enouph :)

This post has been edited by im@geek: 13 July 2009 - 01:18 PM


Is This A Good Question/Topic? 0
  • +

Replies To: PHP Method ?

#2 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1003
  • View blog
  • Posts: 3,562
  • Joined: 05-June 09

Re: PHP Method ?

Posted 13 July 2009 - 01:43 PM

Not sure exactly but I think you're just referring to a templating system, in which case there is no method for it.

You can use a library like Smarty, though.
Was This Post Helpful? 1
  • +
  • -

#3 RPGonzo  Icon User is offline

  • // Note to self: hmphh .... I forgot
  • member icon

Reputation: 151
  • View blog
  • Posts: 954
  • Joined: 16-March 09

Re: PHP Method ?

Posted 13 July 2009 - 01:55 PM

Like Mage said for a templating system look into smarty ... if your speaking framework you can read here but if your just learning it may be worth just building your own simple framework and learning how it all works

But deconstructing any of those systems will be quite [sarcastic]fun[/sarcastic] lol. Your going to be looking at some advanced style PHP

But i not one to stop people from trying so have fun :)
Was This Post Helpful? 1
  • +
  • -

#4 CTphpnwb  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 2934
  • View blog
  • Posts: 10,147
  • Joined: 08-August 08

Re: PHP Method ?

Posted 13 July 2009 - 04:39 PM

Preferred method == OOP
If you've got OOP down, then everything else is easy enough.
;)
Was This Post Helpful? 0
  • +
  • -

#5 RPGonzo  Icon User is offline

  • // Note to self: hmphh .... I forgot
  • member icon

Reputation: 151
  • View blog
  • Posts: 954
  • Joined: 16-March 09

Re: PHP Method ?

Posted 13 July 2009 - 05:11 PM

[sarcastic] And along comes CT with the "easy" way [/sarcastic]

HAHA lol but i would have to agree don't know why i didn't think of saying that before -_-
Was This Post Helpful? 0
  • +
  • -

#6 ShaneK  Icon User is offline

  • require_once("brain.php"); //Fatal error :/
  • member icon

Reputation: 240
  • View blog
  • Posts: 1,224
  • Joined: 10-May 09

Re: PHP Method ?

Posted 13 July 2009 - 06:22 PM

lol CT and his OOP...what a combination ;)

Anyway, most basic way is "including" the header/footer from other files around the information you want on that particular page, then you'll be able to massively edit those files. Though, it's not very sophisticated and if you need to change anything in the header/footer, you'll have problems. I actually ran into this problem today (because, yes, I did use this method on one of my sites) and I plan on going back and making the header (at least) into a class in which I can add javascript and what not.

Yours,
Shane~
Was This Post Helpful? 0
  • +
  • -

#7 CTphpnwb  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 2934
  • View blog
  • Posts: 10,147
  • Joined: 08-August 08

Re: PHP Method ?

Posted 14 July 2009 - 03:23 PM

View PostShaneK, on 13 Jul, 2009 - 09:22 PM, said:

lol CT and his OOP...what a combination ;)

Anyway, most basic way is "including" the header/footer from other files around the information you want on that particular page, then you'll be able to massively edit those files.

:P
If you do:

<?php
include("myclass_definition.php");
$myobject = new myclass;
$myobject->call_some_function();
.
.
.
etc.
?>

then you end up with code that is easily modified because everything is in a function or is the relatively short controlling code that calls the functions. Functions are essentially little programs, and little programs are much easier to debug than large programs! That's why OOP is so important.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1