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

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
Ruben_c
Forum Members
Forum Members
Posts: 35
Joined: Thu Jun 17, 2010 3:12 am
Location: Chile

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

Post 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.
A simple template that you can do with CMS Made simple.

http://www.octoporos.cl
Peciura

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

Post by Peciura »

I load content using ajax
How exactly you did that ?
Ruben_c
Forum Members
Forum Members
Posts: 35
Joined: Thu Jun 17, 2010 3:12 am
Location: Chile

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

Post 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.
A simple template that you can do with CMS Made simple.

http://www.octoporos.cl
Peciura

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

Post 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.
/* */
Ruben_c
Forum Members
Forum Members
Posts: 35
Joined: Thu Jun 17, 2010 3:12 am
Location: Chile

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

Post 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?
A simple template that you can do with CMS Made simple.

http://www.octoporos.cl
NaN

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

Post 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.
Ruben_c
Forum Members
Forum Members
Posts: 35
Joined: Thu Jun 17, 2010 3:12 am
Location: Chile

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

Post 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?
A simple template that you can do with CMS Made simple.

http://www.octoporos.cl
NaN

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

Post 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.
Ruben_c
Forum Members
Forum Members
Posts: 35
Joined: Thu Jun 17, 2010 3:12 am
Location: Chile

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

Post 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  ???
A simple template that you can do with CMS Made simple.

http://www.octoporos.cl
Peciura

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

Post 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" :)
Ruben_c
Forum Members
Forum Members
Posts: 35
Joined: Thu Jun 17, 2010 3:12 am
Location: Chile

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

Post 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)
Last edited by Ruben_c on Thu Nov 11, 2010 2:00 am, edited 1 time in total.
A simple template that you can do with CMS Made simple.

http://www.octoporos.cl
Peciura

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

Post 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.
/* */
Last edited by Peciura on Thu Nov 11, 2010 9:52 pm, edited 1 time in total.
Ruben_c
Forum Members
Forum Members
Posts: 35
Joined: Thu Jun 17, 2010 3:12 am
Location: Chile

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

Post 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.
A simple template that you can do with CMS Made simple.

http://www.octoporos.cl
Post Reply

Return to “CMSMS Core”