PHP - Moved: Adding .tpl File To Php Smarty Based Website
This topic has been moved to Other Libraries and Frameworks.
http://www.phpfreaks.com/forums/index.php?topic=355225.0 Similar TutorialsThis topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=357370.0 Why smarty won't find my template file?
Fatal error: Uncaught --> Smarty: Unable to load template file 'test.tpl' <-- thrown in C:\xampp\htdocs\testing\includes\smarty\sysplugins\smarty_internal_templatebase.php on line 129also did testinstall $smarty->testInstall(); Smarty Installation test... Testing template directory... C:\xampp\htdocs\testing\templates\frontend\default\tpl is OK. Testing compile directory... C:\xampp\htdocs\testing\templates_c\frontend is OK. Testing plugins directory... C:\xampp\htdocs\testing\includes\smarty\plugins is OK. Testing cache directory... C:\xampp\htdocs\testing\cache is OK. Testing configs directory... C:\xampp\htdocs\testing\configs is OK. Testing sysplugin files... ... OK Testing plugin files... ... OK Tests complete.And get template dir var_dump($smarty->getTemplateDir());array(1) { [0]=> string(55) "C:/xampp/htdocs/testing/templates/frontend/default/tpl\" } File schema htdocs -- testing -- incluses -- smarty plugins sysplugins Smarty.class.php SmartyBC.class.php -- configs configs.php -- db connect.php db.php -- configs -- cache -- templates -- frontend -- default -- css -- mages -- js -- tpl test.tpl -- backend -- templates_c -- frontend index.phpindex.php <?php ini_set('display_errors', 1); ini_set('log_errors', 1); ini_set('display_startup_errors', TRUE); ini_set('error_log', dirname(__FILE__) . '/error_log.txt'); error_reporting(E_ALL); ob_start(); session_start(); require 'includes/smarty/Smarty.class.php'; require 'includes/db/db.php'; require 'includes/configs/configs.php'; $page = isset($_GET['do']) ? $_GET['do'] : ''; switch($page){ case 'home'; include 'pages/home.php'; break; default: include 'pages/test.php'; break; } ob_flush(); ?>configs.php <?php $smarty = new Smarty(); $smarty->compile_check = true; $smarty->debugging = false; $smarty->cache = 1; $smarty->setTemplateDir('C:/xampp/htdocs/testing/templates/frontend/default/tpl'); $smarty->setCompileDir('C:/xampp/htdocs/testing/templates_c/frontend/default'); $smarty->setCacheDir('C:/xampp/htdocs/testing/cache'); $smarty->setConfigDir('C:/xampp/htdocs/testing/configs'); ?>test.php <?php //$success = 'Success Message'; //$error = 'Error Message'; $errors[] = 'Error one'; $errors[] = 'Error two'; $smarty = new Smarty; //$smarty->assign('success', $success); //$smarty->assign('error', $error); $smarty->assign('errors', $errors); $smarty->display('test.tpl'); ?>test.tpl {if !empty($errors)} <div id="errors"> {section name=i loop=$errors} {$errors[i]}<br /> {/section} </div> {/if} This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=352099.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=321319.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=319414.0 Hello, This is what I'm trying to-do. I have an index.php file I would like a bit of code that says "If you got here from www.websitea.com (or a link within that site) OR www.websiteb.com" do this : else do this: I'm just not sure how to check where they're coming from. so basically if your on google.ca and you goto the site it will exicute the else part of the code but if your already on sitea or b and you click a link it will not i have been been given a project to create a website where registered users can answer some mathematics test questions,after anwering the questions and submitting, they should be able to see the sumarry of their test score showing the questions they got correctly, the ones anwred wrongly and the test score. please someone should help me with a sample script in php. me email address is nelboy4u@yahoo.com
Hi all i have stumbled across an issue and really need some help i have got a function below which i am using in a wordpress plugin. here is the code. // Base function function isd_s3player() { // Plugin Url $s3url = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)); echo '<object type="application/x-shockwave-flash" data="'.$s3url.'dewplayer-playlist.swf" width="235" height="200" id="dewplayer" name="dewplayer"> <param name="wmode" value="transparent" /> <param name="wmode" value="transparent" /> <param name="movie" value="'.$s3url.'dewplayer-playlist.swf" /> <param name="flashvars" value="showtime=true&autoreplay=true&xml='.$s3url.'playlist.php&autostart=1" /> </object>'; } ok the problem i am having is i cant passed the database variable to the playlist.php which the dewplayer needs to call within the function. is their a way to somehow use or set the playlist.php in this function without having to call it seperatly??? Here is my playlist.php <?php $bucket = get_option("isd-bucket"); $folder = get_option("isd-folder"); //include the S3 class if (!class_exists('S3'))require_once('s3/S3.php'); //AWS access info if (!defined('awsAccessKey')) define('awsAccessKey', 'amazon key'); if (!defined('awsSecretKey')) define('awsSecretKey', 'amazon secret key'); //instantiate the class $s3 = new S3(awsAccessKey, awsSecretKey); // Get the contents of our bucket $bucket_contents = $s3->getBucket($bucket,$folder); header("Content-type: text/xml"); $xml_output = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"; $xml_output .= '<playlist version="1" xmlns="http://xspf.org/ns/0/">\n'; $xml_output .= "<trackList>\n"; foreach ($bucket_contents as $file){ $fname = $file['name']; $furl = "http://$amazon_bucket.s3.amazonaws.com/".urlencode($fname); if(preg_match("/\.mp3$/i", $furl)) { if (isset($outputted[$furl])) { continue; } $xml_output .= "\t<track>\n"; $xml_output .= "\t\t<location>" . $furl . "</location>\n"; $xml_output .= "\t\t<creator>" . $fname . "</creator>\n"; $xml_output .= "\t\t<album>" . $fname . "</album>\n"; $xml_output .= "\t\t<title>" . basename($fname) . "</title>\n"; $xml_output .= "\t\t<annotation>I love this song</annotation>\n"; $xml_output .= "\t\t<duration>32000</duration>\n"; $xml_output .= "\t\t<image>covers/smetana.jpg</image>\n"; $xml_output .= "\t\t<info></info>\n"; $xml_output .= "\t\t<link>" . $furl . "</link>\n"; $xml_output .= "\t</track>\n"; $outputted[$furl] = true; } } $xml_output .= "</trackList>"; echo $xml_output; ?> ok so as you can see right at the top i am trying to grab two option from the database but it doesnt allow you to do it this way within wordpress. So i guess what i am asking is their a way to completely skip the playlist.php file and do everything within the function??? Any help?? This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=359538.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=358615.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=320834.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=354366.0 See if I can explain this right.
I am currently using static files for a very basic set of pages.
Right now i have a main file that has three includes. a header include, body and footer.
Due to needing to add pages, i don't want to keep adding more and more files. instead I want to use php to change one of the includes based on the url.
so thissite.com/index.php?lesson1 would change this
<?php include("header.php"); ?> <?php include("content-lessons.html"); ?> <?php include("footer.php"); ?>to this <?php include("header.php"); ?> <?php include("lesson1.html"); ?> <?php include("footer.php"); ?>or whichever way would be the best way to set the second include. my guess was that if the second line had something like this? if(isset($_GET['lesson1'])){ include('include/in-'.$_GET['lesson1.html']can someone give me a starting place here? i am pretty sure i can pick ti up if someone gets me going in the right direction. thanks a ton. Edited by story97, 12 January 2015 - 09:03 PM. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=359179.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=359077.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=315834.0 Hello, I have a form that ends up creating a file. The file has one of two values in the file: specials.php specials8.php Within several of my web pages, I have an image map, and I would like one of the href values to be the value that PHP would get from the underlying file. How would I code this to make the image map function accordingly? Notice the "Daily Specials" entry within the image map. It is this href that I need to become the value from the file. The unsuccessful code that I tried is: <?php $file38a = "test/activate.txt"; $file38b = file_get_contents("$file38a"); echo "<img src=\"sample2/sidebar1.jpg\" alt=\"Collegeville Diner\" width=\"94\" height=\"330\" border=\"0\" align=\"top\" usemap=\"#Map2\" longdesc=\"http://collegevillediner.com\" />"; echo "<map name=\"Map2\" id=\"Map2\">"; echo "<area shape=\"rect\" coords=\"8,102,88,152\" href=\"about.htm\" target=\"_self\" alt=\"About the Diner\" />"; echo "<area shape=\"rect\" coords=\"7,159,90,204\" href=\"menu.htm\" target=\"_self\" alt=\"Our Menu\" />"; echo "<area shape=\"rect\" coords=\"7,214,90,262\" href=\"$file38b\" target=\"_self\" alt=\"Daily Specials\" />; <area shape=\"rect\" coords=\"0,275,86,320\" href=\"desserts.htm\" target=\"_self\" />"; echo "</map>"; ?> This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=330084.0 hello. im trying to get the following to work. any ideas for me? Code: [Select] Text[12]=["Job Description","$description it "] it is in a .js file. |