473,408 Members | 2,477 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Custom Templates for PHP Script

11
Hey. I'm currently developing a free PHP script, but I realize that people will not want the same template. How can I let the users add custom templates to the script? Are there any good tutorials on this? I've heard to use smarty but I'm not exactly sure how to use it in this respect. Thanks for any answers!
Mar 29 '09 #1
1 1181
dlite922
1,584 Expert 1GB
@BaKo
you create your default templates (with smarty) which are TPL files with {$smarty_assigned_vars}

Please can change the HTML surrounding the variables, remove ones they don't want, etc.

You just have to document what variables your giving them and what type they are (ie. string, array, date, number) even though PHP is loosly typed, it is still a good idea because smarty doesn't always give you obvious clues when you use a variable wrong, such as an array.

example of this implemenation could be:

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. //*PHP CODE HERE//
  4. $bar = "test"; 
  5.  
  6. $smarty->assign("foo",$bar); 
  7. $smarty->display("tempate_file.tpl"); 
  8.  
  9.  
Then anyone with basic smarty and HTML knowledge can change the template file to suit them.


I hope this is what you were looking for,




Dan
Mar 31 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: WebRod | last post by:
Hi, i want to rewrite my website to separate the php script from the HTML code. Therefore a web designer can update the design of the website without any knowledge in PHP. I read a lot of...
5
by: PengYu.UT | last post by:
Hi, I heard that debug some C++ templates is very difficult. I'm wondering whether it is possible to compile C++ program with templates to pure C or C++ program without templates? Best...
5
by: Don | last post by:
Hi: I have created an xsd from my xml document. I pop this xsd in the following directory: C:\program files\Microsoft Visual Studio .NET 2003\Common7\Packages\schemas\xml. That give me...
0
by: Audrey Pratt | last post by:
Happy Holidays to you and allow us to play Santa this year with these awsome deals that in anyway you can refuse: 2000 Web Templates for only $18.00 (Savings Over $1,000.00) ...
4
by: Robert Frunzke | last post by:
Hello, I need to implement a custom allocator to speed up the allocation of a specific class in my project and instead of hardwiring it, I would "templatize"(?) it. The allocator should have...
1
by: Captain Dondo | last post by:
I am not really experienced in Javascript so bear with me.... I am working with an embedded platform; no mouse, no keyboard. Just up, down, left, right keys and +/- keys for...
4
by: =?Utf-8?B?cmtvemxpbg==?= | last post by:
Is it possible to remotely host custom types? Some background... We have an application that uses custom user controls as 'templates' for entering certain kinds of data. The application is...
13
by: Matt F | last post by:
I have a deployment project that I'm setting up. I need to perform a different custom action based on whether this is a first time install or an update. Does anyone have any idea if it's possible...
0
by: Ravi Kumar | last post by:
hi :) I was trying to develop a custom mod_python based web-site, just today. the problem I got though i liked the mod_python's feature of mapping and calling functions in python script by...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.