473,503 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Smarty Problem

Hello

I have a Smarty(.php.net) Question.

I want to create a Navigation with a Smarty Template.

How can I display an Array recursively?
Do I have to write a Plugin?
Exmp.
Array
(
[0] => Array
(
[Text] => "Item 1"
[Childs] => Array
(
[0] => Array
(
[Text] => "Item 1.1"
[Childs] => Array
(
[0] => Array
(
[Text] => "Item 1.1.1"
)
[1] => Array
(
[Text] => "Item 1.1.2"
)
)
)
[1] => Array
(
[Text] => "Item 1.2"
[Childs] => Array
(
[0] => Array
(
[Text] => "Item 1.2.1"
)
[1] => Array
(
[Text] => "Item 1.2.2"
)
)
)
)
)
[1] => Array
(
[Text] => "Item 2"
[Childs] => Array
(
[0] => Array
(
[Text] => "Item 2.1"
)
)
)
)

Something like this
-------------------

{navigation item=item from=$array}
<td>{$item.text}</td>
{/navigation}
Best Regards

Jim
Jul 17 '05 #1
1 2291
On Tue, 14 Sep 2004 14:45:49 +0200, Jim Red <ji******@hotmail.com>
wrote:
Hello

I have a Smarty(.php.net) Question.

I want to create a Navigation with a Smarty Template.

How can I display an Array recursively?
Do I have to write a Plugin?
Exmp.
Array
(
[0] => Array
(
[Text] => "Item 1"
[Childs] => Array
(
[0] => Array
(
[Text] => "Item 1.1"
[Childs] => Array
(
[0] => Array
(
[Text] => "Item 1.1.1"
)
[1] => Array
(
[Text] => "Item 1.1.2"
)
)
)
[1] => Array
(
[Text] => "Item 1.2"
[Childs] => Array
(
[0] => Array
(
[Text] => "Item 1.2.1"
)
[1] => Array
(
[Text] => "Item 1.2.2"
)
)
)
)
)
[1] => Array
(
[Text] => "Item 2"
[Childs] => Array
(
[0] => Array
(
[Text] => "Item 2.1"
)
)
)
)

Something like this
-------------------

{navigation item=item from=$array}
<td>{$item.text}</td>
{/navigation}
Best Regards

Jim

There's {section} and {foreach} you could try.. unless you specifically
wanted to write a {navigation} plugin.

You might also need to make use of {assign} to assign some arrays
temporarily through the stages, inwhich case, a plugin maybe a better
solution as per your specific requirements.

You might also get better / more concise opinions / solutions posting on
the forum at <http://smarty.php.net/>. Some helpful people there too
"specifically" involved in Smarty =)

Regards,

Ian

--
Ian.H
digiServ Network
London, UK
http://digiserv.net/
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2892
by: Daan | last post by:
Hello all, I'm having a little problem with Smarty. Getting it to work in a simple case went fine, but now I have the following situation: / /smarty /templates template.tpl /templates_c
1
2293
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...
2
2591
by: M | last post by:
Hi Folks, I am trying to install Smarty using PHP 5 on a Windows XP PC using IIS v6 The following PHP File: <!doctype html public "-//W3C//DTD HTML 4.0 //EN"> <html> <head>
0
1572
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...
0
1591
by: Conrad | last post by:
Hi, I'm very new to Smarty Template Engine and I'm using PHP 5.0.4 on the Windows XP Professional platform and I have the following question: When I change the 7th line of the script to use a...
2
2053
by: Gene | last post by:
i'm newcomer in using smarty and i have problem like this: i want to have one template file (e.g. index.tpl) in this file section which use variable {$content}. and two files *.php which are using...
0
2134
by: grezlik | last post by:
Hi! I have major problems with cakephp & smarty, (cake ver is 1.2 and smarty 2.6.18 ) there is a code (from cake/libs/view/view.php class SmartyView { .. .. ..
7
2680
by: diane100 | last post by:
Hi I am new to PHP and Smarty (I know only very basic things) and I need help with a warning message I get when I call a page in a browser. I purchased some software from a company who are no...
6
3078
by: K. | last post by:
Hello! I have a problem with using php on smarty web page I would like to use a php code from this web page: http://www.money.pl/webmaster/# i.e.. <?php readfile...
1
2593
by: ajaymohank | last post by:
hello friends.......... i am new to smarty. can anyone please tell me how to get the value from a dynamically generated checkbox using smarty. this is the code i used... here i am generating 10...
0
7202
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
7086
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...
0
7280
Oralloy
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,...
1
6991
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
7460
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
5578
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,...
1
5014
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...
0
1512
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 ...
0
380
bsmnconsultancy
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...

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.