PHP - Moved: Multiple Views In The One Layout Cakephp
This topic has been moved to Application Frameworks.
http://www.phpfreaks.com/forums/index.php?topic=352167.0 Similar TutorialsI'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")); } } ?> I have been learning php and have put together a simple site to track vehicle faults and repairs, but now i am trying to transfer it to cakephp framework to make it easier to work with. My problem is that i have 4 tables,
the fault and repair
a list of vehicles
a list of symptoms
a list of fault codes.
Each repair can have 3 vehicles, 3 symptoms and 3 codes relating to it so i have lookup table to link the fault/repair id to the symptoms, code and vehicles.
i have setup basic code for the vehicle , symptom and fault code models like this:
public $hasAndBelongsToMany = array( 'Fault' => array( 'className' => 'Fault', 'joinTable' => 'Faults_vehicles', 'foreignKey' => 'vehicle_id', 'associationForeignKey' => 'fault_id' ) ); and this lets me search for any faults in the faults table with a given vehicle ID, and this works fine. My problem is how can i set it up so i can do a search for faults in the Faults table with a given vehicle ID and a given symptom ID that have a matching Fault code ID. I am very new to php and have only just started using cakephp so sorry in advance if this makes no sense at all. thanks for your time j This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=332465.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=352357.0 This topic has been moved to Application Frameworks. http://www.phpfreaks.com/forums/index.php?topic=353428.0 This topic has been moved to Application Frameworks. http://www.phpfreaks.com/forums/index.php?topic=308958.0 This topic has been moved to Application Frameworks. http://www.phpfreaks.com/forums/index.php?topic=352519.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=313049.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=353875.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=347122.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=351561.0 I'm trying to write a php page that displays data from a JOIN query for a specific ID table view brandinfo ID, brand, discounttype 1, antioni, no discount brandproducts brandID, producttype, price 1, Tshirt, 20.00 1, Pants, 30.00 1, Shoe, 40.00 the returned result is 1 antioni, no discount, Tshirt, 20.00, 2 antioni, no discount, Pants, 30.00 3 antioni, no discount, Shoe 40.00 The way I want the page to be displayed is ------------------ Antioni (at the top) Table 1. Tshirt 20.00 2. Pants 30.00 3. Shoe 40.00 no discount (at the bottom) ---------------------------- How should I construct the PHP page from the result since they're retrieved as rows? This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=348773.0 This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=347419.0 I hear CakePHP 3.0 being talked about like its something for the future but I also see that you can download it and there are tutorials for it out already. Is it ready for developmental use, or is it still too early for that?
I am looking to learn CakePHP are there recommendations for tutorials on CakePHP?
I have a php file with a ton of vars that i need to access in a number of controllers. How can i simply include this file into a controller in cakephp? ~John This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=350182.0 Ok i want it to make it that everything some clicks on a view the view goes up by one so i did this Code: [Select] <?php session_start(); $views = $_SESSION['views']++; ?> and echo the views like this Views<?php echo $views; ?> but it updates countines to add even if the video is a new video I am looking for a blog app or also a magazine type web app for CakePHP to learn from - any suggestions?
|