ChrisFitz
- Exclusive Author
- Has been a member for 4-5 years
- Referred between 10 and 49 users
- Sold between 1 000 and 5 000 dollars
- United States
54
Purchases
Buyer Rating:
3.69 stars
3.69 average based on 13 ratings.
-
5 Star
646%
-
4 Star
215%
-
3 Star
215%
-
2 Star
17%
-
1 Star
215%
© All Rights Reserved ChrisFitz -
Contact Envato Support


if(isset($_POST['submit'])) { }but if I did a varible for a error
if($username == '') { $error .= "Error"; }Then i echoed it out in the html file like
<?php echo $error; ?>it didn’t work, so i tried adding it to the array part, then used: {ERROR} but then no text would be showing….
Please help.
Hi ItsBrad,
Try “
echo $error;exit;”. The template script usesexitat the end because it buffers the output, so anyechoshould be appended with anexitbefore the template is rendered (before thedisplay()function is called.Let me know if you need anything else.
hi thx for this nice file. you can make an example how to get left with the class used for? index.php? load = news, etc.? best greetings
I would like to invite always another content. Can you help me?
$section = array(); $section[‘news’] = ‘plugins/example/list.php’; $section[‘gb’] = ‘plugins/example2/list.php’;
if (isset($_GET[‘section’], $section[$_GET[‘section’]])) { include $section[$_GET[‘section’]]; } else { include $section[‘news’]; }
Hi palle361,
Can you be more specific on what you’re trying to accomplish?
I want to create a dynamic content Index.php. which is a placeholder in the Index.html outputs the contents of plugins / example / list.php or is invoked when another call plugins/example2/List.php. Include () dosnt work. I hope you now understand what I mean. Greeting
If the pages you’re trying to include are outputting data, either by echo or html code it will not work. In order to be able to do so you’d have to convert the plugins, etc to use the template system as well.
I hope this was what you were asking for, but let me know if you were looking for something else.
When i change the line: if ($result = $database->query($sql, 3600)) { to if ($result = $database->query($sql)) { works then it works but that is not the intention. big thanks and greetings
I have set a value to 0 as default in the database. It’s a rating so unless someone has rated it should show 0. I guess this line ”<?php echo !empty(\$this?>data’.’[’\\1’]) ? \$this->data’.’[’\\1’] : ’’; ?>”, removes that 0 and replaces it with an empty string. Is there any solution to this?
Hi JhonnyL,
You are indeed correct. Thank you for pointing that out, I’ll update it as soon as I can. For now what you can do is change the “empty” with “isset” and that should resolve the issue.
if (isset($_COOKIE['username'])) { // Set the template vars $template->vars(array( 'VAR_1' => $var, 'VAR_2' => 'Hello World!', 'USERNAME' => $_COOKIE['username'], )); $template->display('Index of BM', 'login_main.html', './template/style.css', 'js-file.js'); // Index for user } else { if(isset($_POST['submit'])) { $template->display('Index of BM', 'login_main.html'); // Index for guest } else { $template->display('Index of BM', 'login_main.html'); // Index for guest } }But if the user has errors how can I show them?
Hey ItsBrad,
I’m assuming by errors you mean ones that would arise when they “submit” the form (inside the if statement that’s checking for the
$_POST['submit']). If that’s the case you could do something likeif (isset($_POST['submit'])) { // login logic would go here if ($success) { $title = 'Success!'; $template = 'success.html'; $template->vars(array( 'SUCCESS' => 'It worked!' )); } else { $title = 'Failed!'; $template = 'failed.html'; $template->vars(array( 'FAILED' => 'It didn't work!' )); } $template->display($title, $template); }I’m not sure if this is what you’re looking for, but that’s one way to show errors depending on the result of the form POST . If you’re looking for something else, just let me know and I’ll try to find a method that will work for you.
Hey man, sorry for a really late resonponse it’s not working
Hi ItsBrad,
Can you give me a little more details about what it did do so I can try to help you narrow why it didn’t do what it was supposed to do?
You can capture templates from a mysql database. I have all html files in a database, and need to load the templates from mysql. Is it possible? thanks
Hi novoo,
Unfortunately the way the class was written pulling the template data from a database would be impossible without rewriting the function that retrieves the template.
Hey, I have two classess, one work’s but the other’s not?
Index.php
<?php session_start(); // Initializes the template class include ("./global.php"); // Basic var example $header->header_main(); $main->index_main(); ?>$main->index_main(); isn’t working, seems only one class can work.
Hi ChrisFitz,
I tried compress via yuicompress, but it doesn’t work. file is created but it is not compressed. Compress function returns false. What could be the problem?
Thanks, cheers.
Hi murselturk,
If the file is create, but isn’t compressed when the compression option is enabled it most likely means that either
exec()isn’t able to execute .jar file or java isn’t available on the server. I would check if either of those things are available on your web host, and if they are please double check to make sure the yuicompress file (the .jar file) is in the correct location that is set in the configuration.Hi ChrisFitz,
I sent mail from your profile page. My ftp details are in that mail.
Thanks, cheers.
$query = mysql_query("SELECT * FROM status"); if(!$query) { $template->vars(array( 'MYSQL_ERROR' => mysql_error() )); } while($row = mysql_fetch_array($query)) { $template->loop('mysql', array( 'AUTHOR' => $row['authorpost'] )); } $template->display('Zamiy | Welcome', 'index_main.html', '', null, '');Hi ItsaBrad,
Is there any error that appears, or does it just show up blank? If it shows up blank, can you try to echo $row[‘authorpost’] to the page and see if that works?