The Joomla! Forum ™



Forum rules


Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.



Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Tue Jan 17, 2012 6:02 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Sun Nov 11, 2007 1:15 pm
Posts: 123
Location: Spain
Hi,

I need to create a "raw" view for an AJAX call. I rather prefer not to create new controller nor model neither, since I have yet them and can do what the view needs, I just need to do its output in a "raw" format -without joomla template surrounding- so its output may be used to fill an input field on a JavaScript call.

I have many doubts on this issue.

For example, I have created a new view with this structure into my components administrator part:

/views/commentlist
/views/commentlist/tmpl
/views/commentlist/tmpl/list.php
/views/commentlist/view.raw.php

The view also needs to receive an extra parameter when called, so I will pass it on get as article_id.

First question is how to call now that view, i.e., what URI should I use to link it and what I need to implement on my default controller so it uses that view instead of other.

I think the URL may be something like:

/index.php?option=com_lxncom&task=commentlist.list&article_id=3214

But I am not sure about if this is the correct one, and also what controller will call this and what method I need on the controller to handle that request.

TIA,

_________________
“The media's the most powerful entity on earth. They have the power to make the innocent guilty and to make the guilty innocent, and that's power. Because they control the minds of the masses.” -- Malcolm X


Top
 Profile  
 
PostPosted: Tue Jan 17, 2012 6:33 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Sun Nov 11, 2007 1:15 pm
Posts: 123
Location: Spain
I am getting crazy with this.

It seems like a format=raw parameter is needed for formatting the raw output.

I rather like to use a controller that is called 'comments'. But if I use this link:

/index.php?option=com_lxncom&task=comments.list&format=raw

Then it looks for a controller named comments.raw.php instead of comments.php.

So I tried this other kind of link:

/index.php?option=com_lxncom&controller=comments&task=list&format=raw

And then controller parameter seems to be ignored, and it tries to use the default component controller instead.

So, how can I build a link to use the "comments" controller?

Regards,

_________________
“The media's the most powerful entity on earth. They have the power to make the innocent guilty and to make the guilty innocent, and that's power. Because they control the minds of the masses.” -- Malcolm X


Top
 Profile  
 
PostPosted: Fri Mar 02, 2012 1:38 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Thu Sep 29, 2011 4:05 pm
Posts: 4
Hi

I think what you need for "format=raw" is "tmpl=raw" in the url, for instance:

/index.php?option=com_lxncom&controller=comments&task=list&tmpl=raw


Top
 Profile  
 
PostPosted: Sun Mar 04, 2012 7:16 am 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Aug 27, 2009 3:07 am
Posts: 105
Location: Troy, MI - USA
I should mention I have not tried this, but looking through the code in JController.

try "type=raw" see if that works. You also want to add "tmpl=component" so you only get the component's output instead of modules and such.


Top
 Profile  
 
PostPosted: Sun Mar 04, 2012 8:27 am 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Sep 21, 2010 3:35 pm
Posts: 37
Location: Madrid (Spain)
Hi,

you don't need to call the controller if you only need to render a view. You could try this:

index.php?option=com_lxncom&view=commentlist&format=raw

and then define your view like this:

/views/commentlist
/views/commentlist/tmpl
/views/commentlist/tmpl/default_raw.php
/views/commentlist/view.raw.php

(I'm writing on the go, beware of typos...)

HTH.

_________________
Soporte técnico Joomla en Español: http://www.expertosjoomla.es


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 



Who is online

Users browsing this forum: No registered users and 12 guests


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 post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group