Icy Phoenix

     
 


Post new topic  Reply to topic 
Page 1 of 1
 
 
Reply with quote Download Post 
Post How Do I Parse Single Tpl File 
 
Stupid question, but like Mike I'm sick of looking for what does what.  

This is no doubt designed to include the page header and page footer etc.

full_page_generation('aaa.tpl', $lang['XXX'], '', '');

What string (If possible) is used to parse just the .tpl file.  
 



 
mortSend private message  
Back to topPage bottom
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.

Support us
 
Reply with quote Download Post 
Post Re: How Do I Parse Single Tpl File 
 
Honestly I don't see the reason why you may want to parse a single file, since single file parsing doesn't output anything, unless you then run specific functions.

Anyway, I'll try to answer your question.

From functions.php:
Code: [Download] [Hide] [Select]
function full_page_generation($page_template, $page_title = '', $page_description = '', $page_keywords = '')
{
    global $template, $meta_content;
    $meta_content['page_title'] = (!empty($page_title) ? $page_title : (!empty($meta_content['page_title']) ? $meta_content['page_title'] : ''));
    $meta_content['description'] = (!empty($page_description) ? $page_description : (!empty($meta_content['description']) ? $meta_content['description'] : ''));
    $meta_content['keywords'] = (!empty($page_keywords) ? $page_keywords : (!empty($meta_content['keywords']) ? $meta_content['keywords'] : ''));
    page_header();
    $template->set_filenames(array('body' => $page_template));
    page_footer();
}


So if you want to set var for a specific template you can use the old good code:
Code: [Download] [Hide] [Select]
$template->set_filenames(array('body' => $page_template));

Where 'body' is the handle of the var and $page_template is the name of the template (example: 'your_template_body.tpl').

You may then need to force parsing by using the parse function (which is now run on page_footer() function to optimize code):
Code: [Download] [Hide] [Select]
$template->pparse('body');


In practice it's still the old good phpBB code... nothing has changed in respect to what you were used to do in the past. You only have "smarter" functions now which allows you to have extra flexibility, as I have tried to specify here:

New Icy Phoenix 2.0 Functions: How To Use Them? Header, Footer, CFG


Let me know in case you need extra explanations.
 




____________
Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
 
Mighty GorgonSend private messageSend e-mail to userVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: How Do I Parse Single Tpl File 
 
MG wrote: 
Honestly I don't see the reason why you may want to parse a single file


It's only for testing the code before it's integrated into another script.

And this is why I asked.

If I use this:

Code: [Download] [Hide] [Select]
$template->set_filenames(array('body' => aaa.tpl));
$template->pparse('body');


I get this error - Note there is no dot in aaatpl

Template->make_filename(): Error - template file not found: aaatpl

If I use this:

Code: [Download] [Hide] [Select]
$template->set_filenames(array(
    'body' => 'aaa.tpl')
);
$template->pparse('body');


I get:

Recent Topics
» nmbnm hjghjgh
by admin on 15.09.2012

» fggfdgdgf
by admin on 14.09.2012

» Welcome to Icy Phoenix
by admin on 14.09.2012

» fgfdgdf fggfdgf
by admin on 08.09.2012

» Sample News Post in Portal
by admin on 01.05.2009

Don't know - I even checked it for "hidden" code but couldn't see anything. So you can see why I was confused.  
 



 
Edited by Joshua203, Sat 15 Sep, 2012 13:34: replaced b tags by code tags
mortSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: How Do I Parse Single Tpl File 
 
mort wrote: [View Post]
Code: [Download] [Hide] [Select]
$template->set_filenames(array('body' => aaa.tpl));

That is wrong, because aaa.tpl is a string, so you need to enclose within quotes. In my example I used the var $page_template which I didn't specify it was a string, but template names are always string.

----

Anyway, from what I can see you got what you expected, right?
 




____________
Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
 
Mighty GorgonSend private messageSend e-mail to userVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: How Do I Parse Single Tpl File 
 
Mighty Gorgon wrote: [View Post]
Anyway, from what I can see you got what you expected, right?


Yes, thanks.

Re: the string....

How I missed that - I have no idea    

I should take regular breaks or go to bed earlier. Other than that I'm going to blame my age - or stupidity.  
 



 
mortSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: How Do I Parse Single Tpl File 
 
mort wrote: [View Post]
I should take regular breaks or go to bed earlier. Other than that I'm going to blame my age - or stupidity.  

Well... you shouldn't blame yourself... such kind of things are the things which are going to waste your larger amount of time.

It happened me so many times in the past to fight with some vars types... now I've learned the lesson: every time I debug a specific var, I always use functions as print_r or var_dump to really understand what's happening with my vars (in most cases it saves my day!).

Breaks may help either... but print_r it's still my favourite debugging tool.
 




____________
Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
 
Mighty GorgonSend private messageSend e-mail to userVisit poster's website  
Back to topPage bottom
Post new topic  Reply to topic  Page 1 of 1
 


Display posts from previous:    

HideWas this topic useful?

Link this topic
URL
BBCode
HTML




 
Permissions List
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events


  

 

  cron