logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > General
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 09-20-2007, 12:52 PM   #1
owner
 
Join Date: Sep 2007
Posts: 64
Default Loading a template

Hello,

I am trying to load a template with html code and then the data is just inserted from the database.

Example:

PHP Code:
$function  .= "<tr>
    <td class=\"darkrow1\" colspan=\"8\"><b>
{$this->ipsclass->lang['announce_start']}</b></td>
</tr> 
See how stuff is inserted like this ({$this->ipsclass->lang['announce_start']})

How do you do this? I am a bit confused on this. Is their a tutorial somewhere to get the basics down of this?

Thank you,
-Owner
owner is offline   Reply With Quote
Old 09-20-2007, 01:52 PM   #2
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

its produced using a CLASS (OOP)

you need to study functions and then look at php OOP

http://www.codewalkers.com/c/a/Progr...amming-in-PHP/
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 09-20-2007, 09:53 PM   #3
owner
 
Join Date: Sep 2007
Posts: 64
Default

Davidj, I get what OOP is, and I get how the class and the function works. I am just new to it. I get the basics of OOP.

I don't want to be mean, but for some reason it seems like you think that I don't get 1 general thing about it.
owner is offline   Reply With Quote
Old 09-20-2007, 11:51 PM   #4
owner
 
Join Date: Sep 2007
Posts: 64
Default

Ok, I am super close.

I have a test.php file


Then inside I have

PHP Code:
<?php
function test($links="") { //My function with the argument
$HTML ""//Get rid of any data if any stored in here
 //Yay, html time below!
$HTML .= "<table width=\"25%\" border=\"1\">
  <tr>
    <td>
{$links}</td>
  </tr>
</table>"
;
//end of html
return $HTML//Send the html with the variable inserted
}
?>
Now, what should happen is when this script is initialized, my variable $test should fill in what value it has in the table. My question is, how could I call this in my function without using include (''); The reason I don't want to use include is I will have a ton of little sections like this, and I want them all to be loaded, so what would be the best way to load these up?

Summery: I just need to know howto load this file that I have here in my function. I can do the everything else, but I just don't know where to start to actually grab the info out of this file.

Thank you
-Owner

Last edited by owner; 09-21-2007 at 12:11 AM..
owner is offline   Reply With Quote
Old 09-21-2007, 05:41 AM   #5
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

Quote:
I don't want to be mean, but for some reason it seems like you think that I don't get 1 general thing about it.
48 hours ago you knew nothing about OOP PHP and had the same understanding of Functions. You told me this through messenger and you requested me to help teach you on a one to one basis. I just took this evidence and concluded you knew nothing about OOP!

if the function is in a separate file you have to include it. How else would you get the function into your script.

this bit i don't understand...
PHP Code:
$HTML ""//Get rid of any data if any stored in here
 //Yay, html time below!
$HTML .= "<table width=\"25%\" border=\"1\">
  <tr>
    <td>
{$links}</td>
  </tr>
</table>"

writing vars like this..

PHP Code:
$HTML ="";
$HTML .=""stuff
all this does is concatenate the contents of $HTML so the first one contains nothing so your function is going to join nothing to the table string.


__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 09-21-2007, 10:37 PM   #6
owner
 
Join Date: Sep 2007
Posts: 64
Default

Just never mind this. I am going to give up on this idea. I think I have 2 or 3 topics now and noone seems to understand, so apparently it isn't possible :S

Sorry about this
owner is offline   Reply With Quote
Old 09-22-2007, 06:59 PM   #7
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

your probably right...

its not possible
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 09-22-2007, 06:59 PM   #8
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

dont appologise

your probably right...

its not possible
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:23 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com