Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Search found 306 matches
Smarty Forum Index
Author Message
  Topic: Find array value without foreach?
bsmither

Replies: 2
Views: 73

PostForum: General   Posted: Tue May 11, 2021 8:13 pm   Subject: Find array value without foreach?
My experiment:

{$Class|@print_r}
{$Class|array_column:3|@print_r}
Array
(
[0] => Array
(
[0] => A
&# ...
  Topic: Problem with print_r
bsmither

Replies: 1
Views: 51

PostForum: General   Posted: Tue May 11, 2021 6:20 pm   Subject: Problem with print_r
I made this experiment with Smarty 3.1.36:
{$Class|@print_r}where $Class is a multi-level array.

The HTML source looks like what print_r should look like.

The compiled template has th ...
  Topic: Smarty {comment} tag?
bsmither

Replies: 5
Views: 67772

PostForum: Smarty Development   Posted: Thu May 06, 2021 4:51 am   Subject: Smarty {comment} tag?
What I do is this:
{*
Was: {$event.desc|strip_tags|substr:0:200|trim}
Now: {$event.desc|substr:0:200|trim}
Date: 5 May 2021
Reason: Issue ...
  Topic: Wrap something if var is true
bsmither

Replies: 9
Views: 293

PostForum: General   Posted: Fri Apr 30, 2021 11:56 pm   Subject: Wrap something if var is true
If you use {capture name="foo"}, the block of code that is captured can be used in multiple other places, but developed in just one place.

{capture name="foo"}
<di ...
  Topic: Add a line break after 3 words
bsmither

Replies: 5
Views: 616

PostForum: General   Posted: Wed Mar 24, 2021 10:21 pm   Subject: Add a line break after 3 words
So, this is MOD(3)?

This will break after every third word.
  Topic: Add a line break after 3 words
bsmither

Replies: 5
Views: 616

PostForum: General   Posted: Wed Mar 24, 2021 4:28 am   Subject: Add a line break after 3 words
Try:
{$name_array = " "|explode:$product.name}{foreach $name_array as $name}{if $name@index eq 3}<br>{/if}{$name} {/foreach& ...
  Topic: Driving me nuts. How to exclude results on match.
bsmither

Replies: 6
Views: 720

PostForum: General   Posted: Wed Mar 24, 2021 3:45 am   Subject: Driving me nuts. How to exclude results on match.
You said:
On the order form there is an option called "Performance model", which has 4 options (Slow, Medium, Normal and Fast).
If you select "slow" or "medium" it will ...
  Topic: Driving me nuts. How to exclude results on match.
bsmither

Replies: 6
Views: 720

PostForum: General   Posted: Sat Mar 20, 2021 4:19 pm   Subject: Driving me nuts. How to exclude results on match.
Are the email contents reflective of what was actually subscribed to, or is this a marketing email describing what is available?

If a summary of what was subscribed to, does the array $configoption ...
  Topic: PHP scripts in sharfed hosting environment
bsmither

Replies: 7
Views: 2529

PostForum: Installation and Setup   Posted: Mon Mar 08, 2021 10:29 pm   Subject: PHP scripts in sharfed hosting environment
I would say that book would improve your understanding of where Smarty sits in the development process, and elaborates on the possibilities given to the site designer (as opposed to the data modeller ...
  Topic: What is the diff. between {include} & {extends}?
bsmither

Replies: 7
Views: 1008

PostForum: General   Posted: Sun Feb 21, 2021 11:28 pm   Subject: What is the diff. between {include} & {extends}?
I see the difference as being the "point-of-view".

Given templates A and B. A is a superstructure (<html>,<head>,<body>, etc.). B is a component (<table>, etc).
...
  Topic: Variable per day
bsmither

Replies: 2
Views: 710

PostForum: General   Posted: Fri Feb 12, 2021 8:32 pm   Subject: Variable per day
today we are 04/02/2021
we need 'to have :
from 02/01/2021 to 02/07/2021

to have from next Monday:
from 02/08/2021 to 02/14/2021
You have mixed your data formats.

Is 04/02/2021 April 2, or 4 ...
  Topic: Find year +1
bsmither

Replies: 3
Views: 835

PostForum: General   Posted: Fri Feb 12, 2021 8:04 pm   Subject: Find year +1
Try this:
{assign "woohoo" 'Y'|date:strtotime("next year")}
Test: {$woohoo}
  Topic: Choose template for small/big screens
bsmither

Replies: 2
Views: 744

PostForum: General   Posted: Fri Jan 22, 2021 11:13 pm   Subject: Choose template for small/big screens
Because Smarty compiles the template before sending it to the browser, Smarty will need to be told by some code in the PHP script of what the screen viewport size happens to be.
  Topic: Am I calling this function correctly?
bsmither

Replies: 6
Views: 985

PostForum: General   Posted: Fri Jan 22, 2021 5:52 pm   Subject: Am I calling this function correctly?
Functions, Classes, Global Variables, and Constants created/declared in the script cannot be used directly by name in Smarty template code.

Smarty provides an indirect way to access the server requ ...
  Topic: Am I calling this function correctly?
bsmither

Replies: 6
Views: 985

PostForum: General   Posted: Fri Jan 22, 2021 1:26 am   Subject: Am I calling this function correctly?
I think {redirect} is not a Smarty command. Nor is it a PHP command.

Because Smarty does not know what this is, Smarty stops and complains.
 
Page 1 of 21 Goto page 1, 2, 3 ... 19, 20, 21  Next
All times are GMT
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP