Jump to content

Ginho

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Everything posted by Ginho

  1. I would use my cms to another site and create a new template with ease, thanks to the separation of design and code. that's all... for example, i tried to see the joomla code but i'm getting crazy, and i don't know how can do this. Thanks.
  2. OK. perfect. one question: how do you manage the pages? Currently I have two files, called header.php and footer.php, which I include on the interested page. And you? What's the better method to manage pages in a CMS? Thanks
  3. Why? I can parse it with some filters... so how can I di this?
  4. xD c'mon rough guess it's better xD Thanks again... i've got an idea! is it right create a tag , where the php code will process? can i do this with a simple if? Cheers P.S = are correct the periods i wrote? xD
  5. Thank you! I did not know. Wow with your solution, 5 lines have been optimized in 1! awesome! but how can i include php files correctly? Thanks for your patience
  6. Yeah, it works. I've tried this but the php code it isn't been elaborate. ? foreach is a cycle, preg_replace is something completely different... explain better Thanks guys
  7. I see this tutorial on Youtube: http://www.youtube.com/watch?v=QjRHjVgnT0o and honestly I tried to act on various parts of the code, but I haven't got more ideas on how to modify... Thanks you for your interest.
  8. Here's the index.php, which uses the template engine error_reporting(E_ALL); ini_set("display_errors", 1); //Includo il template engine require_once("template.php"); //Includo i files di configurazione //Configurations file require_once("include/config.php"); require_once("include/connect.php"); require_once("include/funzioni.php"); $Template = new Template('default.tpl'); $Template -> set("Titolo_Pagina", "Benvenuti in Ginho! - Il sito che parla di tutto ci? che ruota attorno all'informatica"); $Template -> set("Descrizione", "Il sito che parla di tutto ci? che ruota attorno all'informatica"); $Template -> set("Left", require_once('pages/left.php')); echo $Template->output(); it isn't show any error, and it isn't include correctly.(look the attachement in the first post). config.php contains the costant for the DB connection, connect.php connect to the DB, funzioni.php contains general function (in this case doesn't matter with the current problem) I haven't got any idea to solve it. i've tried the impossible, but.. nothing. It's a vital issue xD Thanks again I use return only to output the render template with this: return $this->output; Sorry, I will adjust it for next time
  9. I posted the whole class, I've broken it to better understand. class Template{ public $output; public $file; public $values = array(); function __construct($file) { $this->file = $file; $this->output = file_get_contents($this->file); } function set($key, $value){ $this->values[$key] = $value; } function output() { foreach($this->values as $key => $value) { $Tags_To_Replace = "[$key]"; $this->output = str_replace($Tags_To_Replace, $value, $this->output); } return $this->output; } }
  10. First of all thank you function set: function set($Key, $Value){ $this->Values[$Key] = $Value; } function: __construct: function __construct($file) { $this->File = $File; $this->output = file_get_contents($this->File); } function output: function output() { foreach($this->Values as $Key => $Value) { $Tags_To_Replace = "[$Key]"; $this->output = str_replace($Tags_To_Replace, $Value, $this->output); } return $this->output; } declaration of the variables: public $output; public $File; public $Values = array(); Sorry I was confused Thanks again for the help.
  11. Ciao a tutti, I'm new and I've got a question: I made ​​small template engine in PHP and works very well with a HTML file. But when I wanna include a PHP file, in the part I wanted, it shows "1" and the file is included at the top of the page. Here's a part of the code (maybe the affected): foreach($this->values as $key => $value) { $Tags_To_Replace = "[$key]"; $this->output = str_replace($Tags_To_Replace, $value, $this->output); } return $this->output; "values" is an array $this->output = file_get_contents($this->file); the code for include the file set("Left", require_once('pages/left.php')); Can someone help me? If you need more information, ask Thanks Thanks so much!! P.S = Sorry for my bad english, i'm italian
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.