PHP - Template System
I've created a template system.
I've got a function to assign a page (the templates are in /template/skin). It all works fine in the main root, but if I had a directory it won't work. $dir = "template/skin"; That is found in template/ I need to be able to assign the template even in directories. Similar TutorialsThe current system I am using has worked so far but it has its problems. Basically I have 2 files to display forum topics. view_topics.php and topic_list_tpl.php view_topics.php defines some variables like so $template->topic_name = $row[$key]['topic_name'] then it renders the page like so $template->render('topic_list_tpl.php'); then in topic_list_tpl.php i use this to print the name of the topic <?php echo $this->topic_name; ?> which works fine. But as you know a topic list needs a header. But the render function is within a foreach loop so it displays all of the topics from the query. This poses the problem of the header being looped, which it shouldnt be. So in view_topics.php i use: $template->topic_id = $row[$key]['topic_id']; $template->first_topic_id = $row[0]['topic_id']; then in topic_list_tpl.php i can use: <?php if($this->topic_id == $this->first_topic_id) { echo the header } else { echo the topics } but the problem comes when adding a footer bar at the bottom(for the new reply link and other topic options). i can use something like $amount_of_topics = count($row); $template->last_topic_id = $row[$amount_of_topics-1]['topic_id'] and then check it like that but that wont work when using pagination as the last topic displayed isnt always going to be the last topic in the query. So another option i have is to have the header and footer bars in seperate files and call them outside of the loop. But these files would only be 2 or 3 lines each. So is this the best option? or is there an easier way of doing things? Hey guys, I'm starting to build a website and I was wondering wether I should use a library template engine such as smarty, or use pure php, such as this tutorial - http://www.massassi.com/php/articles/template_engines/ Basically the website will not expose any of the users/designers to the designer portion of the website. I am scratching my head wether I should use smarty or pure php, even Facebook uses smarty, from what I have heard. I need some answers. Thank you all! Hey guys first of all I got 3 files - index.php require_once('/libs/template.class.php'); $template = new Template; $template->assign("title","test"); template.php <?php echo $title; ?> template.class.php function assign($var, $val) { $var = $val; } I'm trying to assign a variable in index.php, then recall it in the template.php, how would I go about this? Thank you! I've made a template system, but the way I've chosed to do it doesn't give me the ability to choose a design. I've posted the code below with a bad solution for my design problem. Does anyone have any suggestions how to make a very simple and smart templatesystem? I don't have any problems coding. I just need ideas :-) Code: [Select] <?php final class View implements IView { protected $filename, $variables = array(); public function __construct($filename = null, $variables = array()) { $this->filename = $filename; $this->variables = $variables; } public function __toString() { if(!file_exists($this->filename)) { throw new Exception("View does not exists."); } $content = file_get_contents($this->filename); foreach($this->variables as $variable => $value) { $content = str_replace("#{{$variable}}", $value, $content); } return str_replace("#{content}", $content, file_get_contents("design.html")); } } ?> This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=359002.0 hello dear PHP-Fans - greetings to you - and a happy new year!! i set up a WAMP-System on my openSuse 11.4 system. In order to learn as much as i can bout PHP i want to do some tests and write some scripts. Well the WAMP is allready up and running. Now i try to give the writing access to the folder mkdir /srv/www/ where the php-scripts should go in... i want to give write permission to all to all files in /srv/www As root I generally: mkdir /srv/www/ chown <webmaster usrername> /srv/www/ /srv/www/ should be readable and traversable by all, but only writeable by it's owner (the user designated as the webmaster.) can i do this like mentioned above,... Love to hear from you greetings db1 hey guys im making a template class which is working and im trying to impliment a loop section for MySQL results... but i need to be able to find a match for a string such as: {section name=1 loop=$2} content {/section} but also extract the values of name, loop and the section content if anyone could advise me on the best way this can be done please...thank you I'm trying to develop a website file manager. I want to allow SSI, and would like to handle it specifically.. Code: [Select] $regexp = "<!--#include\s[^>]*virtual=(\"??)([^\" >]*?)\\1[^>]*\/-->"; if(preg_match_all("/$regexp/siU", $body, $matches, PREG_SET_ORDER)) { foreach($matches as $match) { $includeFile = $match[2]; } } This snippet shows how you would get the included file path in the SSI code of the website body [ the $body tag ], but I don't need to just find it- I want to replace the SSI code with a simpler code in the HTML that appears in the editor for easy management.. Then switch back from my easier code to the actual SSI code.. Example: Replace Code: [Select] <!--#include virtual="/newsManager/output.php"--> With Code: [Select] {INCLUDE=/newsManager/output.php} THEN when the user saves the page, Replace Code: [Select] {INCLUDE=/newsManager/output.php} With Code: [Select] <!--#include virtual="/newsManager/output.php"--> Is there an easy fix or should I just switch to a full blown template engine.. even though this is the only required feature? Ok... So I have a while() query to pull support tickets from my database. I would like to setup a system where the while() function is called inside a template file, without having the template file contain the lines of code for it. Example While Function: $open_tickets = mysql_query("SELECT * FROM support_tickets WHERE user_id='$id' && order_by='1' && ticket_status='open' ORDER BY ticket_id DESC") or die(mysql_error()); while($tick = mysql_fetch_array($open_tickets, MYSQL_ASSOC)) { ?> <tr><td><a href="tickets.php?id=<?php echo $tick['ticket_id'].'">'.$tick['ticket_title']; ?></a></td><td><div align="center"><?php echo $tick['ticket_reply']; ?></div></td><td><div align="center"><?php echo $tick['ticket_urgency']; ?></div></td></tr> <?php } It would be awesome if I could get all that to run off of looping variables so that the template looks like: <?php $begin_while; ?> <tr><td><a href="tickets.php?id=<?php echo $ticket_id; ?>"><?php echo $ticket_title; ?></a></td><td><div align="center"><?php echo $ticket_reply; ?></div></td><td><div align="center"><?php echo $ticket_urgency; ?></div></td></tr> <?php $end_while; ?> or something similar. Suggestions? I don't want to implement smarty or another template system, at least not yet... I just want something in php that can do what's described above. Of course all I'm really looking for is something that looks cleaner... Could I make the while function $tick into something smaller and place the query into the system instead of the template? Hello i am going to try out fpdf generator, but i wanted to know if anyone knows where i can get invoice templates or how would i go to create them. Could i create them with css and html? hello. how can i code this so that if the page is an admin page i get the admin template and if the page is a public page i get the public template i seem to be having trouble with my function and if statements this is the code Code: [Select] //$layout gets the header.php and the footer.php function include_layout($layout){ //this part find all pages Zone. zone is either Admin or Public $pageZone = Pages::find_all(); foreach ($pageZone as $pageZones){ $Pzone = $pageZones->zone; } //this part gets the template id that is set for admin and public $tempBS = BasicSettings::find_by_id(1); $atID = $tempBS->adminTemp_id; $ptID = $tempBS->publicTemp_id; // if page is admin get the admin template if ($pZone = "admin"){ $Atemp = Templates::find_adminTemp($atID); $ATname = $Atemp->name; include(TEMP.DS.$ATname.DS.'layouts'.DS.$layout); } // if page is public get the public template if($pZone = "public"){ $Ptemp = Templates::find_publicTemp($ptID); $PTname = $Ptemp->name; include(TEMP.DS.$PTname.DS.'layouts'.DS.$layout); } } to help you understand what im doing i have put a // description above each part of code. the problem is that i get the header echoed out twice. if i change the if to an if else like this... Code: [Select] if ($pZone = "admin"){ $Atemp = Templates::find_adminTemp($atID); $ATname = $Atemp->name; include(TEMP.DS.$ATname.DS.'layouts'.DS.$layout); }else if($pZone = "public"){ $Ptemp = Templates::find_publicTemp($ptID); echo $PTname = $Ptemp->name; include(TEMP.DS.$PTname.DS.'layouts'.DS.$layout); } i only get 1 header but the public template does not work template this is because if i echo out Code: [Select] echo $PTname = $Ptemp->name; i get nothing so. how can i code it so that if the page is an admin page i get the admin template and if the page is a public page i get the public template thanks ricky How do I incorporate wordpress php usage withing standard php? For example, this is typically the template used for the title in wordpress: Code: [Select] <?php the_title(); ?> How would I show that in php, like: Code: [Select] $title = the_title(); //this doesn't work by the way Hey guys, I hate being a beggar but I am trying to figure out how to remove links from aawp-box__image and aawp-box__title. That’s a script from a plugin that uses Amazon to get the name, images, and other stuff of products directly on my site. I was wondering if there is a way to delete the links while still have the images downloaded from Amazon (the plugin is AAWP). Maybe someone can help me here?
<?php /* * Box template * ------------ * It's possible to display multiple boxes at once * * @package AAWP */ if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } ?> <?php foreach ( $this->items as $i => $item ) : ?> <?php $this->setup_item($i, $item); ?> <div class="<?php echo $this->get_classes('box'); ?>" <?php $this->the_product_container(); ?>> <div class="aawp-box__thumb"> <a class="aawp-box__image-link" ?>" title="<?php echo $this->get_product_image_link_title(); ?>" rel="nofollow" target="_blank"> <img class="aawp-box__image" src="<?php echo $this->get_product_image(); ?>" alt="<?php echo $this->get_product_image_alt(); ?>" <?php $this->the_product_image_title(); ?> /> </a> <?php if ( $this->get_product_rating() ) { ?> <div class="aawp-box__rating"> <?php echo $this->get_product_star_rating(); ?> <?php if ( $this->get_product_reviews() ) { ?> <div class="aawp-box__reviews"><?php echo $this->get_product_reviews(); ?></div> <?php } ?> </div> <?php } ?> </div> <div class="aawp-box__content"> <a class="aawp-box__title" ?>" title="<?php echo $this->get_product_link_title(); ?>" rel="nofollow" target="_blank"> <?php echo $this->get_product_title(); ?> </a> <div class="aawp-box__description"> <?php echo $this->get_product_description(); ?> </div> </div> <div class="aawp-box__footer"> <?php if ( $this->get_product_is_sale() ) { ?> <span class="aawp-box__ribbon aawp-box__sale"> <?php if ( $this->show_sale_discount() && $this->is_sale_discount_position('ribbon') ) { ?> <?php echo $this->get_saved_text(); ?> <?php } else { ?> <?php echo $this->get_sale_text(); ?> <?php } ?> </span> <?php } ?> <div class="aawp-box__pricing"> <?php if ( $this->get_product_is_sale() && $this->show_sale_discount() ) { ?> <span class="aawp-box__price aawp-box__price--old"><?php echo $this->get_product_pricing('old'); ?></span> <?php if ( $this->is_sale_discount_position('standard') ) { ?> <span class="aawp-box__price aawp-box__price--saved"><?php echo $this->get_saved_text(); ?></span> <?php } ?> <?php } ?> <?php if ( $this->show_advertised_price() ) { ?> <span class="aawp-box__price aawp-box__price--current"><?php echo $this->get_product_pricing(); ?></span> <?php } ?> <?php $this->the_product_check_prime_logo(); ?> </div> <?php echo $this->get_button('detail'); ?> <?php echo $this->get_button(); ?> <?php if ( $this->get_inline_info() ) { ?> <span class="aawp-box__info"><?php echo $this->get_inline_info_text(); ?></span> <?php } ?> </div> </div> <?php endforeach; ?> I hope that isn’t too much hassle, thank you! hello everyone, i am looking at building a lightweight template engine for some of my scripts that i am using. i have looked into several different ones, and although many have great features, none have exactly what i am looking for. the main thing i haven't liked is that most of them use {placeholder} style tags, which creates unnecessary overhead, because php itself is a template language, so why create a wrapper for something that already does the job? for most of the pure php template classes, this is what i've seen for the most part: : assign variables that replace content : start an output buffer : include the template file : store the rendered content of the template file in a varable : clear the output buffer : return the rendered content i really like this format just because it allows sub-templates in a main file. for instance, i can have a template file for the complete shell, but then have another file to include everytime i want a table, or a menu, or anything modular like that. i was thinking about this though, and basically the entire page is stored in a variable before the output is ever sent to the screen. are there any drawbacks to doing it this way? what about speed and memory? are there better ways to go about it? Hello All!
Below is a simplified version how I render about every page. Should I start using a dedicated template engine? If so, which one and why? Or, should I stick with my existing system? If so, should I make any changes to it? Thank you <?php class myModel { public function getData() //This would really be a query to a DB { $dataFromMyDB=new stdClass(); $dataFromMyDB->firstname='John'; $dataFromMyDB->lastname='Doe'; $dataFromMyDB->age=111; return $dataFromMyDB; } } /** * Typically used to htmlspecialchars variable. * $nbsp=0: return htmlspecialchars input * $nbsp=1: return htmlspecialchars input or   if nothing * $nbsp=2: return input or   if nothing * @param $html * @param boolean $nbsp */ function h($html,$nbsp=0) { $html=trim($html); switch($nbsp) { //Consider changing ENT_QUOTES to ENT_QUOTES|ENT_XHTML or ENT_QUOTES|ENT_HTML401 case 0:default:$return=htmlspecialchars($html, ENT_QUOTES, 'UTF-8');break; case 1:$return=($html)?htmlspecialchars($html, ENT_QUOTES, 'UTF-8'):' ';break; case 2:$return=($html)?$html:' ';break; } return $return; } function render($viewFile,$model) { ob_start(); require $viewFile; $html_string=ob_get_contents(); ob_end_clean(); return $html_string; } $model=new myModel(); echo(render('mvc_view.php',$model->getData())); ?>mvc_view.php <p>Hello! This is my View</p> <?php echo(h($model->firstname).' '.h($model->lastname).' is '.h($model->age).' years old.'); ?> I am about as new to PHP as one can get but I had done something similar to what I am trying to do now nearly a decade ago. I am using perhaps the most simple templating system I can. I have VERY specific needs and 'engines' such as SMARTY are too big for my purposes. My program is quite simple as far as the templates go. Straight HTML-based template file with tags. Naturally. I will have a specific list of usable tags defined for use by the end-user to create their templates. I will post an example of the template class file, the html template file and one of the php files that will tie it together. I want to state that everything is working exactly as it should except for template tags which invoke a function. The functions are running exactly as they should and they output exactly what they should. However what it puts out is being put before the opening HTML tag. I haven't shown the code yet but the value of [[site_title]] DOES show between the HTML title tags as it should. But the two which kick off functions are before the HTML. I ran into the same thing when I first tried a very similar templating deal in PERL and someone pointed out that I needed to make everything that the functions put out concatenates to $template so that it is 'compiled' within the template. But I am not sure if this is what I need to do in PHP or exactly how I would. It could be quite similar but unfortunately I can't recall how I had done it in PERL oh so long ago. Again, I want to throw out that the IF statements within the functions do exactly what they are supposed to do. It's just not showing where it should. Any and all help is greatly appreciated. I will be using this tiny 'engine' in several projects and I will include credit in associated files for any person(s) that are able to help. So I have a simple template that I want to be the index page of the website that I'm working on, however, I don't want to have to create several almost identical files for each of the directories.
Is there perhaps anyway that I can change the content of the main div yet the address be a different directory.
So for example, this is the main index page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <head> <title>Matthew Noskiw's website - Home</title> <link rel='stylesheet' type='text/css' href='./inc/CSS/styles/default.css' /> <link rel='stylesheet' type='text/css' href='./inc/CSS/static/navigation.css' /> </head> <body> <div id='Container'> <div id='Header'> <div class='right'> <ul id='Navigation'> <li id='NavButton' class='active'><a href='./'>Home</a></li> <li id='NavButton'><a href='./about'>About</a></li> <li id='NavButton'><a href='./blog'>Blog</a></li> <li id='NavButton'><a href='./contact'>Contact</a></li> </ul> </div> <span>noskiw.co.uk</span> </div> <hr /> <div id='MainContent'> <h2>Home</h2> <br /> <span> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </span> <br /><br /> <span> Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? </span> </div> <hr /> <div id='Footer'> <span>Matthew Noskiw</span> </div> </div> </body> </html>But if you look in the <h2> tag in the 'MainContent' div, then you'll see it reads "Home". What I want to happen is that when I change the page, for example, go to /about I want it to read <h2>About</h2>. I have 4 different pages for this so far, is there any way to get it down to just one yet they be in different directories? P.S The reason this is in the PHP Help section is because I assumed that it would more than likely be something to do with PHP. Edited by ghostrider1337, 02 August 2014 - 02:36 PM. Hello everyone, Can someone help to add "add to Google Calendar" link referensing booking time, date and location under "Comment" line in this php? <?php $Date=new CHBSDate(); $Length=new CHBSLength(); $Validation=new CHBSValidation(); $BookingFormElement=new CHBSBookingFormElement(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <?php if(is_rtl()) { ?> <style type="text/css"> body { direction:rtl; } </style> <?php } ?> </head> <body> <table cellspacing="0" cellpadding="0" width="100%" bgcolor="#EEEEEE"<?php echo $this->data['style']['base']; ?>> <tr height="50px"><td></td></tr> <tr> <td> <table cellspacing="0" cellpadding="0" width="600px" border="0" align="center" bgcolor="#FFFFFF" style="border:solid 1px #E1E8ED;padding:50px"> <!-- --> <?php $logo=CHBSOption::getOption('logo'); if($Validation->isNotEmpty('logo')) { ?> <tr> <td> <img style="max-width:100%;height:auto;" src="<?php echo esc_attr($logo); ?>" alt=""/> <br/><br/> </td> </tr> <?php } ?> <!-- --> <tr> <td <?php echo $this->data['style']['header']; ?>><?php esc_html_e('General','chauffeur-booking-system'); ?></td> </tr> <tr><td <?php echo $this->data['style']['separator'][3]; ?>><td></tr> <tr> <td> <table cellspacing="0" cellpadding="0"> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php esc_html_e('Title','chauffeur-booking-system'); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>><?php echo $this->data['booking']['booking_title']; ?></td> </tr> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php esc_html_e('Status','chauffeur-booking-system'); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>><?php echo esc_html($this->data['booking']['booking_status_name']); ?></td> </tr> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php esc_html_e('Service type','chauffeur-booking-system'); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>><?php echo esc_html($this->data['booking']['service_type_name']); ?></td> </tr> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php esc_html_e('Transfer type','chauffeur-booking-system'); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>><?php echo esc_html($this->data['booking']['transfer_type_name']); ?></td> </tr> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php esc_html_e('Pickup date and time','chauffeur-booking-system'); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>><?php echo esc_html($Date->formatDateToDisplay($this->data['booking']['meta']['pickup_date']).' '.$Date->formatTimeToDisplay($this->data['booking']['meta']['pickup_time'])); ?></td> </tr> <?php if(in_array($this->data['booking']['meta']['service_type_id'],array(1,3))) { if((int)$this->data['booking']['meta']['transfer_type_id']===3) { ?> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php esc_html_e('Return date and time','chauffeur-booking-system'); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>><?php echo esc_html($Date->formatDateToDisplay($this->data['booking']['meta']['return_date']).' '.$Date->formatTimeToDisplay($this->data['booking']['meta']['return_time'])); ?></td> </tr> <?php } } if((int)$this->data['booking']['meta']['price_hide']===0) { ?> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php esc_html_e('Order total amount','chauffeur-booking-system'); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>><?php echo esc_html(CHBSPrice::format($this->data['booking']['billing']['summary']['value_gross'],$this->data['booking']['meta']['currency_id'])); ?></td> </tr> <?php if($this->data['booking']['meta']['payment_deposit_enable']==1) { ?> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php echo sprintf(esc_html('To pay (deposit %s%%)','chauffeur-booking-system'),$this->data['booking']['meta']['payment_deposit_value']); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>><?php echo esc_html(CHBSPrice::format($this->data['booking']['billing']['summary']['pay'],$this->data['booking']['meta']['currency_id'])); ?></td> </tr> <?php } if(in_array($this->data['booking']['meta']['service_type_id'],array(1,3))) { ?> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php esc_html_e('Distance','chauffeur-booking-system'); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>> <?php echo $Length->format($this->data['booking']['billing']['summary']['distance'],$this->data['booking']['meta']['length_unit']); ?> </td> </tr> <?php } } ?> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php esc_html_e('Duration','chauffeur-booking-system'); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>> <?php echo esc_html($this->data['booking']['billing']['summary']['duration']); ?> </td> </tr> <?php if($this->data['booking']['meta']['passenger_enable']==1) { ?> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php esc_html_e('Passengers','chauffeur-booking-system'); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>><?php echo esc_html(CHBSBookingHelper::getPassengerLabel($this->data['booking']['meta']['passenger_adult_number'],$this->data['booking']['meta']['passenger_children_number'])); ?></td> </tr> <?php } if($Validation->isNotEmpty($this->data['booking']['meta']['comment'])) { ?> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php esc_html_e('Comment','chauffeur-booking-system'); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>><?php echo esc_html($this->data['booking']['meta']['comment']); ?></td> </tr> <?php } ?> </table> </td> </tr> <!-- --> <tr><td <?php echo $this->data['style']['separator'][2]; ?>><td></tr> <tr> <td <?php echo $this->data['style']['header']; ?>><?php esc_html_e('Route','chauffeur-booking-system'); ?></td> </tr> <tr><td <?php echo $this->data['style']['separator'][3]; ?>><td></tr> <tr> <td> <table cellspacing="0" cellpadding="0"> <?php if($this->data['booking']['meta']['service_type_id']==3) { ?> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php esc_html_e('Route name','chauffeur-booking-system'); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>><?php echo esc_html($this->data['booking']['meta']['route_name']); ?></td> </tr> <?php } if(in_array($this->data['booking']['meta']['service_type_id'],array(1,3))) { if($this->data['booking']['meta']['extra_time_enable']==1) { ?> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php esc_html_e('Extra time','chauffeur-booking-system'); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>><?php echo esc_html($Date->formatMinuteToTime($this->data['booking']['meta']['extra_time_value'])); ?></td> </tr> <?php } } ?> </table> </td> </tr> <!-- --> <tr><td <?php echo $this->data['style']['separator'][2]; ?>><td></tr> <tr> <td <?php echo $this->data['style']['header']; ?>><?php esc_html_e('Route locations','chauffeur-booking-system'); ?></td> </tr> <tr><td <?php echo $this->data['style']['separator'][3]; ?>><td></tr> <tr> <td> <table cellspacing="0" cellpadding="0"> <tr> <td> <ol <?php echo $this->data['style']['list'][1]; ?>> <?php foreach($this->data['booking']['meta']['coordinate'] as $index=>$value) { $address=esc_html($value['address']); if(array_key_exists('formatted_address',$value)) $address='<b>'.esc_html($value['formatted_address']).'</b> '.$address; ?> <li <?php echo $this->data['style']['list'][2]; ?>><a href="https://www.google.com/maps/?q=<?php echo esc_attr($value['lat']).','.esc_attr($value['lng']); ?>" target="_blank"><?php echo $address; ?></a></li> <?php } ?> </ol> </td> </tr> </table> </td> </tr> <!-- --> <tr><td <?php echo $this->data['style']['separator'][2]; ?>><td></tr> <tr> <td <?php echo $this->data['style']['header']; ?>><?php esc_html_e('Vehicle','chauffeur-booking-system'); ?></td> </tr> <tr><td <?php echo $this->data['style']['separator'][3]; ?>><td></tr> <tr> <td> <table cellspacing="0" cellpadding="0"> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php esc_html_e('Vehicle name','chauffeur-booking-system'); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>><?php echo esc_html($this->data['booking']['meta']['vehicle_name']); ?></td> </tr> </table> </td> </tr> <!-- --> <?php if(count($this->data['booking']['meta']['booking_extra'])) { ?> <tr><td <?php echo $this->data['style']['separator'][2]; ?>><td></tr> <tr> <td <?php echo $this->data['style']['header']; ?>><?php esc_html_e('Extra','chauffeur-booking-system'); ?></td> </tr> <tr><td <?php echo $this->data['style']['separator'][3]; ?>><td></tr> <tr> <td> <table cellspacing="0" cellpadding="0"> <tr> <td> <ol <?php echo $this->data['style']['list'][1]; ?>> <?php foreach($this->data['booking']['meta']['booking_extra'] as $index=>$value) { ?> <li <?php echo $this->data['style']['list'][2]; ?>> <?php echo esc_html($value['quantity']); ?> <?php esc_html_e('x','chauffeur-booking-system'); ?> <?php echo esc_html($value['name']); ?> <?php if((int)$this->data['booking']['meta']['price_hide']===0) { echo ' - '.CHBSPrice::format(CHBSPrice::calculateGross($value['price'],0,$value['tax_rate_value'])*$value['quantity'],$this->data['booking']['meta']['currency_id']); } ?> </li> <?php } ?> </ol> </td> </tr> </table> </td> </tr> <?php } ?> <!-- --> <tr><td <?php echo $this->data['style']['separator'][2]; ?>><td></tr> <tr> <td <?php echo $this->data['style']['header']; ?>><?php esc_html_e('Client details','chauffeur-booking-system'); ?></td> </tr> <tr><td <?php echo $this->data['style']['separator'][3]; ?>><td></tr> <tr> <td> <table cellspacing="0" cellpadding="0"> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php esc_html_e('First name','chauffeur-booking-system'); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>><?php echo esc_html($this->data['booking']['meta']['client_contact_detail_first_name']); ?></td> </tr> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php esc_html_e('Last name','chauffeur-booking-system'); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>><?php echo esc_html($this->data['booking']['meta']['client_contact_detail_last_name']); ?></td> </tr> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php esc_html_e('E-mail address','chauffeur-booking-system'); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>><?php echo esc_html($this->data['booking']['meta']['client_contact_detail_email_address']); ?></td> </tr> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php esc_html_e('Phone number','chauffeur-booking-system'); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>><?php echo esc_html($this->data['booking']['meta']['client_contact_detail_phone_number']); ?></td> </tr> <?php echo $BookingFormElement->displayField(1,$this->data['booking']['meta'],2,array('style'=>$this->data['style'])); ?> </table> </td> </tr> <!-- --> <?php if((int)$this->data['booking']['meta']['client_billing_detail_enable']===1) { ?> <tr><td <?php echo $this->data['style']['separator'][2]; ?>><td></tr> <tr> <td <?php echo $this->data['style']['header']; ?>><?php esc_html_e('Billing address','chauffeur-booking-system'); ?></td> </tr> <tr><td <?php echo $this->data['style']['separator'][3]; ?>><td></tr> <tr> <td> <table cellspacing="0" cellpadding="0"> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php esc_html_e('Company name','chauffeur-booking-system'); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>><?php echo esc_html($this->data['booking']['meta']['client_billing_detail_company_name']); ?></td> </tr> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php esc_html_e('Tax number','chauffeur-booking-system'); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>><?php echo esc_html($this->data['booking']['meta']['client_billing_detail_tax_number']); ?></td> </tr> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php esc_html_e('Street name','chauffeur-booking-system'); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>><?php echo esc_html($this->data['booking']['meta']['client_billing_detail_street_name']); ?></td> </tr> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php esc_html_e('Street number','chauffeur-booking-system'); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>><?php echo esc_html($this->data['booking']['meta']['client_billing_detail_street_number']); ?></td> </tr> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php esc_html_e('City','chauffeur-booking-system'); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>><?php echo esc_html($this->data['booking']['meta']['client_billing_detail_city']); ?></td> </tr> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php esc_html_e('State','chauffeur-booking-system'); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>><?php echo esc_html($this->data['booking']['meta']['client_billing_detail_state']); ?></td> </tr> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php esc_html_e('Postal code','chauffeur-booking-system'); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>><?php echo esc_html($this->data['booking']['meta']['client_billing_detail_postal_code']); ?></td> </tr> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php esc_html_e('Country','chauffeur-booking-system'); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>><?php echo esc_html($this->data['booking']['client_billing_detail_country_name']); ?></td> </tr> <?php echo $BookingFormElement->displayField(2,$this->data['booking']['meta'],2,array('style'=>$this->data['style'])); ?> </table> </td> </tr> <?php } $panel=$BookingFormElement->getPanel($this->data['booking']['meta']); foreach($panel as $panelIndex=>$panelValue) { if(in_array($panelValue['id'],array(1,2))) continue; ?> <tr><td <?php echo $this->data['style']['separator'][2]; ?>><td></tr> <tr> <td <?php echo $this->data['style']['header']; ?>><?php echo esc_html($panelValue['label']); ?></td> </tr> <tr><td <?php echo $this->data['style']['separator'][3]; ?>><td></tr> <tr> <td> <table cellspacing="0" cellpadding="0"> <?php echo $BookingFormElement->displayField($panelValue['id'],$this->data['booking']['meta'],2,array('style'=>$this->data['style'])); ?> </table> </td> </tr> <?php } ?> <!-- --> <?php if(!empty($this->data['booking']['meta']['payment_id'])) { ?> <tr><td <?php echo $this->data['style']['separator'][2]; ?>><td></tr> <tr> <td <?php echo $this->data['style']['header']; ?>><?php esc_html_e('Payment','chauffeur-booking-system'); ?></td> </tr> <tr><td <?php echo $this->data['style']['separator'][3]; ?>><td></tr> <tr> <td> <table cellspacing="0" cellpadding="0"> <tr> <td <?php echo $this->data['style']['cell'][1]; ?>><?php esc_html_e('Payment','chauffeur-booking-system'); ?></td> <td <?php echo $this->data['style']['cell'][2]; ?>> <?php echo esc_html($this->data['booking']['payment_name']); if($Validation->isNotEmpty($this->data['booking']['woocommerce_payment_url'])) echo '<br><a href="'.esc_url($this->data['booking']['woocommerce_payment_url']).'" target="_blank">'.__('Click to pay for this order','chauffeur-booking-system').'</a>'; ?> </td> </tr> </table> </td> </tr> <?php } ?> </table> </td> </tr> <tr height="50px"><td></td></tr> </table> </body> </html> Many thanks Edited June 30, 2019 by KOTI followed this tutorial http://www.dynamicdrive.com/forums/showthread.php?t=28260. Everything is working fine but I cannot get the title on selected page to display. It will only display "Home" for the title on every page. I need this to say the correct title of selected page |