|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
i-litovan Smarty Rookie
Joined: 03 Aug 2013 Posts: 13
|
Posted: Tue Sep 17, 2013 6:02 am Post subject: Print 1 & Exit in My template |
|
|
Hi.
I have this template:
Code: |
<h1>Header</hh1>
next template code
next template code
next template code
next template code
{php}
print 1111;
exit();
{/php}
next template code
next template code
next template code
next template code
|
I run a Smarty and get:
<h1>Header</hh1>
next template code
next template code
next template code
next template code
1111
How can I get only 1111?
--
Ivan/.
[/code] |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Sep 17, 2013 6:42 pm Post subject: |
|
|
your script exits right after printing 1111.
exit();
the exit() function ceases the execution of PHP altogether, not just exiting the php script you are in.
and FWIW, don't use {php} tags at all if possible. |
|
Back to top |
|
i-litovan Smarty Rookie
Joined: 03 Aug 2013 Posts: 13
|
Posted: Sat Sep 21, 2013 12:06 pm Post subject: |
|
|
mohrt wrote: | your script exits right after printing 1111.
exit();
the exit() function ceases the execution of PHP altogether, not just exiting the php script you are in.
and FWIW, don't use {php} tags at all if possible. |
You are right ...
Thenk you. |
|
Back to top |
|
sophiaMia Smarty n00b
Joined: 06 Sep 2014 Posts: 1
|
Posted: Sat Sep 06, 2014 6:08 am Post subject: |
|
|
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.pl'
######################### We start with some black magic to print on failure.
# Change 1..1 below to 1..last_test_to_print .
# (It may become useful if the test is moved to ./t subdirectory.)
BEGIN { $| = 1; print "1..16\n"; }
END {print "not ok " . ++$testid . "\n" unless $loaded;}
use HTML::Template::Extension;
use HTML::Template::Extension::ObjBase;
# Create test obj with support for doing nothing but standart:=)
# DON'T USE DO_NOTHING...IT'S ONLY AN BASE EXTENSION MODULE FOR CREATING NEW ONES
my $comp = new HTML::Template::Extension(
filename => 'templates/standard.tmpl',
plugins=>["DO_NOTHING"],
);
$comp->param('test' => "It works!!!");
$_ = $comp->output;
print;
if (m/It works/) {
print "\nok " . ++$testid . "\n";
} else {
exit;
}
imprenta online |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue Sep 30, 2014 1:30 pm Post subject: |
|
|
Is there a "report" button on this forum?… |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|