Created
June 24, 2015 18:57
-
-
Save maccevedor/899100fd9f7f9bd8a300 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# src/DMW/DemoBundle/Resources/views/Notice/index.html.twig #} | |
{% extends 'DMWDemoBundle::layout.html.twig' %} | |
{% block content %} | |
<div> | |
<p>Noticias recientes</p> | |
<ol> | |
{% for index,notice in notices %} | |
<li><a href="{{ path('DMWDemoBundle_noticeView', {'notice_id': index}) }}">{{notice.title}}</a></li> | |
{% endfor %} | |
</ol> | |
<div id="notice_viewer"> | |
{# en esta capa serán cargadas las noticias por ajax #} | |
</div> | |
</div> | |
{% endblock content %} | |
{# extendemos el bloque javascript #} | |
{% block javascripts %} | |
{{parent()}} {# incluimos las declaraciones de script del layout, como jQuery #} | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$('a.notice_link').click(function(event){ | |
event.preventDefault(); //cancela el comportamiento por defecto | |
$('#notice_viewer').load($(this).attr('href')); //carga por ajax a la capa "notice_viewer" | |
}); | |
}); | |
</script> | |
{% endblock javascripts %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment