LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-08-2007, 12:24 AM   #1
mohtasham1983
Member
 
Registered: Apr 2005
Location: San Jose
Distribution: Fedora 3,4- Ubuntu 6.06 to 8.10, Gentoo and Arch
Posts: 408

Rep: Reputation: 30
How to set a function to a variable in PHP HTML_Template_IT


Hello everyone,
I have made a template for the website I'm working on using PHP HTML_Template_IT pear. It's really neat and useful especially If you are going to add new features to your website.

Anyway, When I created my template, I made several empty places in it and set some variable name to them. When I use this template I just use an expression to set the proper variable as shown below.

Code:
$template->setVariable("second_menu6","Help");
Everything is fine, when I'm assigning a string or a simple integer or any other types of variables.

My big issue is when I call a function from another file which creates a table.

Calling include 'functions/league_table.inc'; at the beginning of the file simply makes a table on top of my page.

I really don't know why it shows the table since it's an *.inc file.

I also tried to use following method to set the variable, but it just prints 1.

Code:
$s=include 'functions/league_table.inc';
$template->setVariable("second_top_left",$s);
I will appreciate your help.

Thanks for reading.
 
Old 07-08-2007, 11:40 AM   #2
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
Hi

You didn't post the contents of league_table.inc so it's not possible to say for sure, but I guess it contains just HTML for a table. If it is, use the file_get_contents function instead. Include is meant for including PHP code, and the file extension doesn't matter at all.
 
Old 07-08-2007, 08:55 PM   #3
mohtasham1983
Member
 
Registered: Apr 2005
Location: San Jose
Distribution: Fedora 3,4- Ubuntu 6.06 to 8.10, Gentoo and Arch
Posts: 408

Original Poster
Rep: Reputation: 30
Basically it contains PHP codes with embedded html in it.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
communicate a php variable to a javascript function Kanaflloric Programming 4 08-11-2006 12:58 PM
php function->query(variable) what's that? osio Programming 3 06-12-2006 06:48 AM
How do I set a PHP variable = to a HTML textbox's value? nickiv Programming 4 06-06-2005 01:41 PM
PHP Variable = function? wh33t Programming 2 01-22-2005 06:28 AM
Passing one php function result as a parameter to another php function davee Programming 13 09-12-2004 12:08 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration