Answer the question
In order to leave comments, you need to log in
How to "redirect" to another part of the template under another GET request in smarty?
Hello!
$action is taken from the php file, in which the value is passed to the template. $action itself is $_GET['action'];
The structure of my tpl file is like this:
{if $action eq 'html_tags' || $action eq 'html_attributes'}
// Тут общий код для двух случаев $action.
{if $action eq 'html_tags'}
// Тут код для случая html_tags.
{else}
// Тут код для случая html_attributes.
{/if}
{else}
// Тут прочий код. Это не важно.
{/if}
$('.link_attr').click(function(){
var id = $(this).attr('title');
$.ajax({
type: 'GET',
url: '/site/templates/templates.tpl',
data: {'action' : 'html_attributes'},
success: function(data){
// Тут некоторые действия.
}
});
});
Answer the question
In order to leave comments, you need to log in
but nothing that smarty is a server-side engine? A direct link to tpl will do nothing.
In general, it is likely that the HTML renderer for the $action eq 'html_tags' block lies in some HTML element - its content must be cleared by clicking on the link and the result of the server script execution must be added as innerHTML . Obviously, the script only needs to render a portion of the HTML from the entire template.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question