Page 1 of 1

loading ajax! :), problem with {} tags :(

Posted: Wed Nov 10, 2010 8:01 am
by Ruben_c
I load content using ajax, but I have problems with modules, like gallery because {gallery}  is just loaded like text (of course), but ¿how can it work? ¿How can it proccess in the request? I don't know how.

Re: loading ajax! :), problem with {} tags :(

Posted: Wed Nov 10, 2010 9:34 am
by Peciura
I load content using ajax
How exactly you did that ?

Re: loading ajax! :), problem with {} tags :(

Posted: Wed Nov 10, 2010 3:26 pm
by Ruben_c
with jquery. I make the request to the DB through a php file that is not of the core of the cms. So I need to know what variables or file I must to include in the process file to execute the {} tags.

It´s like this:

Code: Select all

<__script__ type="text/javascript" language="javascript" src="uploads/js/jquery.js"></__script>
<__script__ language="javascript">
function Cargo(){
	$("#links a").click(function(){
		UpdateDiv(this.href);
		return false;
	});
}
function UpdateDiv(Url){
	$.ajax({
		type: 'get',
		url: Url,
		dataType: 'html',
		success: function(data){
			$("#data").html(data)
		}
	});
}
$(document).ready(Cargo);
</__script>

and the menu

Home

I load the content, but I need to know what vaiables or files include in ifes.php to process the modules.

Re: loading ajax! :), problem with {} tags :(

Posted: Wed Nov 10, 2010 4:53 pm
by Peciura
If url is appended with "showtemplate=false" CMSMS returns processed content only. Additionally you can specify required div (it could be #data in your case). There should also exist  parent div of #data div only.
/* */

Re: loading ajax! :), problem with {} tags :(

Posted: Wed Nov 10, 2010 5:35 pm
by Ruben_c
I'm sorry but I'm not an expert in javascript. ;D  ¿I need replace my code with your code or use both or mix? Becouse  if I only use your code it send me to ifes.php but don't load dinamicly.

and also "showtemplate=false" ¿must be added in the link with the menu manager?

Re: loading ajax! :), problem with {} tags :(

Posted: Wed Nov 10, 2010 6:22 pm
by NaN
Well there is a misunderstanding.
ifes.php does not belong to CMSms.
So "showtemplate=false" doesn't do anything.

What Peciura meant was to use only CMSms stuff to load the content.
(no external script like ifes.php <- what does this do anyway?)
That means you should use the link of the MenuManager to load the content. (what will link to index.php?page=home)
If you append "showtemplate=false" to the url that is created by the MenuManager it will load the processed content only (without the layout stuff).

So use a default CMSms menu and Peciuras script.

Re: loading ajax! :), problem with {} tags :(

Posted: Wed Nov 10, 2010 9:18 pm
by Ruben_c
Many thanks :D; Peciura and Nan it work fine and load the content of the {gallery}. But don't load the javascript and the css associated :-[

it's necessary make a different script to load that? or I just miss something?

Re: loading ajax! :), problem with {} tags :(

Posted: Wed Nov 10, 2010 9:42 pm
by NaN
Gallery module inserts the javascript and the css in the head section of your template.
Since there is no template processed it cannot do that.
Try to paste the js and the css in the main Gallery template.
Something like this:

Code: Select all


{literal}
<style type="text/css">
...
</style>
<__script__ language="JavaScript" type="text/javascript" src="...">
<__script__ language="JavaScript" type="text/javascript">
...
</__script>
{/literal}

{Gallery smarty stuff here}

So js and css belongs to the Gallery content.

Re: loading ajax! :), problem with {} tags :(

Posted: Wed Nov 10, 2010 9:52 pm
by Ruben_c
Well, I try with the change in the gallery but now I have this error "jQuery("#links a").live is not a function" and don't work. I set all like I have before and nothing  ???

Re: loading ajax! :), problem with {} tags :(

Posted: Thu Nov 11, 2010 1:16 am
by Peciura
You could always include required JavaScripts and CSS to your template (check if Gallery can skip this action).
Link to your site would be very handy... I would like to see what tells you "jQuery("#links a").live is not a function" :)

Re: loading ajax! :), problem with {} tags :(

Posted: Thu Nov 11, 2010 1:56 am
by Ruben_c
Many thanks paciura,  I use my functions again and all work fine. the links is www.octoporos.com/templates and the template where I use ajax is Testing (select it from dropdown list if it's not there)

Re: loading ajax! :), problem with {} tags :(

Posted: Thu Nov 11, 2010 3:36 am
by Peciura
Would you create another template for jQuery (mod of "Testing") ? Also put to new so it had parent div (not body). Menu urls should be appended with &showtemplate=false by JavaScript. This way they will be 100% working without JavaScript only.
/* */

Re: loading ajax! :), problem with {} tags :(

Posted: Thu Nov 11, 2010 5:51 pm
by Ruben_c
Thanks again paciura, I'll take your advise to do another template.

Meanwhile I made another adaptation called minimal_ajax. if you want see it from dropdown and click switch.