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

http_response_code(404);

 
Post new topic   Reply to topic    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
asmar
Smarty n00b


Joined: 26 Oct 2008
Posts: 4

PostPosted: Wed Feb 08, 2017 9:06 pm    Post subject: http_response_code(404); Reply with quote

Hi all,

I've got among others the following code:

Code:

{if $paginate.total eq '0'}
<meta http-equiv="refresh" content="0;url={$smarty.const.WEBSITE_ROOT}/404.html">
{/if}


What I want is to replace the redirect with a plain 404 using the http_response_code(404);. Any idea how I can add the:
http_response_code(404);
and replace the whole line with the meta?

If I just added even in php tags or not it just displays the text browser and doing nothing.
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1622

PostPosted: Thu Feb 09, 2017 8:05 am    Post subject: Reply with quote

You can't send headers once body is sent.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP