Hi there,
does anyone know how to use smarty to generate a selection list without
PHP assigning a array?
eg. a list for selection minutes, but without php to assign a 1~60
array into smarty.
Thanks in advance. 5 6969
also, I want to put in id inside the <select> tag as well. gl**@tollnz.co. nz wrote: does anyone know how to use smarty to generate a selection list without PHP assigning a array? eg. a list for selection minutes, but without php to assign a 1~60 array into smarty.
also, I want to put in id inside the <select> tag as well.
Can't help you with the first question, I think you need to use a PHP
array (but it can be one line, like: $seconds = range(1..60) or
something. Look up the range() function for the exact syntax.
You can put your own attributes in Smarty tags simply like this:
{html_options name="name" options=$option s id="id"}
JP
--
Sorry, <de*****@cauce. org> is a spam trap.
Real e-mail address unavailable. 5000+ spams per month.
On 3 Apr 2005 19:36:23 -0700, "gl**@tollnz.co .nz" <gl**@tollnz.co .nz>
wrote: Hi there,
does anyone know how to use smarty to generate a selection list without PHP assigning a array? eg. a list for selection minutes, but without php to assign a 1~60 array into smarty.
Thanks in advance.
<select name="mins" id="mins">
{section name=mins loop=60}
<option value="{$smarty .section.mins.i teration}">
{$smarty.sectio n.mins.iteratio n}
</option>
{/section}
</select>
HTH =)
Regards,
Ian
--
Ian.H
digiServ Network
London, UK http://digiserv.net/
thanks guys, here is a more challenging question
regarding on Ian's solution,
how do I add 0 infront of the numbers that is less than 10?
so I will have 01, 02, ~ 10
thanks in advance
On 5 Apr 2005 19:47:04 -0700, "gl**@tollnz.co .nz" <gl**@tollnz.co .nz>
wrote: thanks guys, here is a more challenging question regarding on Ian's solution,
how do I add 0 infront of the numbers that is less than 10? so I will have 01, 02, ~ 10
thanks in advance
Use the string_format modifier:
<http://smarty.php.net/manual/en/language.modifi er.string.forma t.php>
{section name=foo loop=10}
<option name="{$smarty. section.foo.ite ration}">
{$smarty.sectio n.foo.iteration |string_format: "%02d"}
</option>
{/section}
Regards,
Ian
--
Ian.H
digiServ Network
London, UK http://digiserv.net/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Brian |
last post by:
Hello,
I am trying to work out how to have smarty use a string's contents as the
display-> template..
ie:
$smarty->display($buffer);
obviously $buffer isn't a filename, but a smarty template inside a string
variable. Take this example:
|
by: Richard |
last post by:
I need help. I have a smarty based program that I am modifying. I
have a smarty template file that consists of smarty and HTML.
I need to integrate some PHP database calls into it. My problem is I
cannot figure out how to pass value between smarty and PHP. Going
from php to smarty I've tried this:
{php}
$smarty = new Smarty;
$smarty->assign("x", 100);
|
by: Matt |
last post by:
geez, i've done this a million times, you'd think i could get it right.
uploading to production server for a new site, and part of the head.inc
that starts everything up looks like this:
echo SMARTY_DIR."Smarty.class.php<br>";
require_once(SMARTY_DIR."Smarty.class.php");
if (substr(phpversion(),0,1) == "4") {
$smarty = new Smarty;
|
by: Random Person |
last post by:
Does anyone know how to use VBA to relink tables between two MS Access
databases? We have two databases, one with VBA code and the other with
data tables. The tables are referenced by linked tables in the database
where the code resides. If we move the database with the data tables to
a new directory, the links are no longer valid.
I tried to update the links by changing the Connect property and refreshing:
Set td = db.TableDefs(0)...
|
by: Daveyk0 |
last post by:
Hello there,
I have a front end database that I have recently made very many changes
to to allow off-line use. I keep copies of the databases on my hard
drive and link to them rather than the live databases on the network.
Is there a way, via code, when I get back in-house from being on the
road to click a button, and select the backends I want to link to?
I would want to delete all the current links and link to the "live"
| |
by: webguynow |
last post by:
I like Smarty but I may have to design something similar myself, bc I'm
having trouble getting it installed on my Shared WebHost.
There are good examples out there. One on CodeWalkers
http://codewalkers.com/tutorials/58/1.html
I read a great book once, Enterprise Java, by Jeff Genender, that had
an advance template system, with caching, etc. built into it.
I'm giving another try to do a Smarty installation. After that, are
|
by: ev45ive |
last post by:
Hi!
I have smth. like this:
file.php:
<?php
SmartyValidate::connect($smarty);
//SmartyValidate::register_form('register');
|
by: joeschnell |
last post by:
First week of the current trimester and we've taken a huge leap from writing little code snippets of loops and switches to writing an entire program, and expecting it to work!
I, nor anyone else in my class have heard of structs which is our first assignment. I've been pounding away for several days now and it won't compile beyond my struct declaration. Anyone who knows a bit about C++ I would enjoy you pointing out all of the syntax and...
|
by: sksksk |
last post by:
I want to achieve the following process in the smarty
for $item one i should be able to get the value using
loop.index, but
without any luck.
any help is appreciated.
<?php for ($i = 1; $i <= 30; $i++) : ?>
<tr>
<th><?= $i ?></th>
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |