The Joomla! Forum ™



Forum rules


Please use the official Bug Tracker to report a bug: http://joomlacode.org/gf/project/joomla ... er_id=8103



Post new topic Reply to topic  [ 14 posts ] 
Author Message
PostPosted: Wed Dec 22, 2010 10:09 pm 
User avatar
Joomla! Explorer
Joomla! Explorer

Joined: Sun Dec 13, 2009 9:00 pm
Posts: 366
Location: Switzerland
Not sure if this is intended behaviour or a bug.

In J1.5 we could use JDocument->getInstance('raw') in the component controller to force the document type to be "raw". This was nice in my case for making a podcast view.
In J1.6 this seems to no longer work. After calling it, Joomla will still search for view.html.php and not view.raw.php as expected.

I also tried with the function "JDocument->setType('raw')" but then it produces the error "Unable to load renderer class". So this seems to be not working as well.

The view is working when I add the parameter &format=raw to the URL. So the JDocumentRaw itself seems to be working.

Any thoughts?


Top
 Profile  
 
PostPosted: Fri Dec 24, 2010 10:51 am 
User avatar
Joomla! Exemplar
Joomla! Exemplar

Joined: Thu Aug 18, 2005 8:43 pm
Posts: 7986
Location: New York
This might be useful for you:
http://docs.joomla.org/Xml-rpc

(It's really about all document types.)

_________________
So we must fix our vision not merely on the negative expulsion of war, but upon the positive affirmation of peace. MLK 1964.
http://officialjoomlabook.com Get it at http://www.joomla.org/joomla-press-official-books.html Buy a book, support Joomla!.


Top
 Profile  
 
PostPosted: Fri Dec 24, 2010 12:10 pm 
User avatar
Joomla! Explorer
Joomla! Explorer

Joined: Sun Dec 13, 2009 9:00 pm
Posts: 366
Location: Switzerland
Thanks for the link, it was an interesting read! But I think it doesn't answer my issue, or I miss something.

In J1.5 I could use the following code in my controller to force the document type "raw" for my 'feed' view:

Code:
// Get the document object.
$document = JFactory::getDocument();

if (JRequest::getCmd('view') == 'feed' && (JRequest::getCmd('format') != 'raw')){
    // Changing the podcast format to raw output
    $document = $document->getInstance('raw');
}

This allowed me to catch the instance where one would call the view without the URL parameter '&format=raw'.
This no longer works in J1.6 for some reason. Joomla will not change the document type and thus creates an error because it can't find the view.html.php (which doesn't exists for this view). In J1.5 this code changed the document type and it looked for view.raw.php and everything was working fine.

I'm still not sure if this is a bug or how we could change a document type "on runtime" like we could in J1.5.

It's nothing gamebreaking. I still can just create a redirect to the same page with an added parameter '&format=raw'. But if there is a way to change it directly, it would be silly to reload the page :)


Top
 Profile  
 
PostPosted: Fri Jun 24, 2011 10:11 am 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Sun Jan 13, 2008 1:46 am
Posts: 114
Maybe I misunderstand your problem, but if this is your component, can't you just add a view.raw.php view to your component and call it with
view index.php?option=mycomponent&format=raw
If I need a raw view, I just copy my view.html.php and rename it to view.raw.php

What i'm trying to do is get a raw output from the com_search component by adding the querystring format=raw without adding a view.raw.php file to the core com_search component.

_________________
Check out my joomla extensions at www.acoolsip.com


Top
 Profile  
 
PostPosted: Fri Jun 24, 2011 11:25 am 
User avatar
Joomla! Explorer
Joomla! Explorer

Joined: Sun Dec 13, 2009 9:00 pm
Posts: 366
Location: Switzerland
That's what I do. I have a view.raw.php in my view and it's working with the URL parameter &format=raw. But in Joomla 1.5 we could change the document type during runtime, which allowed to catch the case where a view is called without the URL parameter for various reasons (user error, simpler URL, ...). This seems to be no longer possible in J1.6.

Also your case will not be possible. &format=raw always needs a view.raw.php in the view directory or it will fail.
If you only want the output from the component without the modules, you could use &tmpl=component parameter.


Top
 Profile  
 
PostPosted: Fri Jun 24, 2011 7:03 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Sun Jan 13, 2008 1:46 am
Posts: 114
Bakual wrote:
That's what I do. I have a view.raw.php in my view and it's working with the URL parameter &format=raw. But in Joomla 1.5 we could change the document type during runtime, which allowed to catch the case where a view is called without the URL parameter for various reasons (user error, simpler URL, ...). This seems to be no longer possible in J1.6.

Also your case will not be possible. &format=raw always needs a view.raw.php in the view directory or it will fail.
If you only want the output from the component without the modules, you could use &tmpl=component parameter.


I understand now. What about trying to force the raw view like this in the controller
Code:
if (some case that turns out to be true){
    // Changing the podcast format to raw output
    JRequest::setVar('view','myview');
    JRequest::setVar('format','raw');
}


P.S. &tmpl=component is okay, but I still get a bunch of html like <body> and <head> and stuff like that so it's not gonna work for my purposes.
I read a blog post from the guy who wrote Tienda and NOixACL and they mention overriding any components controller using a plugin. If I can override the controller then I can definitely write and instance my own view and do it that way. I haven't quite figured out how they're doing it though.

_________________
Check out my joomla extensions at www.acoolsip.com


Top
 Profile  
 
PostPosted: Fri Jun 24, 2011 7:31 pm 
User avatar
Joomla! Explorer
Joomla! Explorer

Joined: Sun Dec 13, 2009 9:00 pm
Posts: 366
Location: Switzerland
I think I tried all the obvious stuff and it didn't work. It looks like the document is already set when Joomla loads the component controller.


Top
 Profile  
 
PostPosted: Fri Jun 24, 2011 7:56 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Sun Jan 13, 2008 1:46 am
Posts: 114
Bakual wrote:
I think I tried all the obvious stuff and it didn't work. It looks like the document is already set when Joomla loads the component controller.


I did some testing and it looks like you're right about that. That totally sucks. The document shouldn't be set until the display() method is called in my opinion.

_________________
Check out my joomla extensions at www.acoolsip.com


Top
 Profile  
 
PostPosted: Fri Jun 24, 2011 8:13 pm 
User avatar
Joomla! Explorer
Joomla! Explorer

Joined: Sun Dec 13, 2009 9:00 pm
Posts: 366
Location: Switzerland
That's true.


Top
 Profile  
 
PostPosted: Wed Aug 17, 2011 12:28 am 
Joomla! Intern
Joomla! Intern

Joined: Tue Aug 29, 2006 11:08 pm
Posts: 56
Did you ever find a Solution to this problem?
I'm experiencing the same problem with Joomla 1.7.

_________________
Joomla Hosting: http://www.helpinghost.com/hosting-plan/joomla-hosting.html


Top
 Profile  
 
PostPosted: Wed Aug 17, 2011 7:53 am 
User avatar
Joomla! Explorer
Joomla! Explorer

Joined: Sun Dec 13, 2009 9:00 pm
Posts: 366
Location: Switzerland
I did not find a solution itself. In just use a workaround in the controller and reload the page if &format=raw isn't passed for this particular view.


Top
 Profile  
 
PostPosted: Wed Aug 17, 2011 1:25 pm 
Joomla! Intern
Joomla! Intern

Joined: Tue Aug 29, 2006 11:08 pm
Posts: 56
Thanks,
not pretty, but it will do for now.

_________________
Joomla Hosting: http://www.helpinghost.com/hosting-plan/joomla-hosting.html


Top
 Profile  
 
PostPosted: Thu Oct 13, 2011 11:58 pm 
User avatar
Joomla! Ace
Joomla! Ace

Joined: Sat Oct 28, 2006 11:16 pm
Posts: 1240
Location: Texas
That sucks.

I'm running into the same problem, except I'm attempting to create a soapservice, so a redirect won't work for me. I'd rather not need to include format=raw, but there are already so many other get vars that I suppose one more won't matter.

_________________
My extensions: http://extensions.joomla.org/extensions/owner/stutteringp0et
Honk if this signature offends you.


Top
 Profile  
 
PostPosted: Wed Feb 15, 2012 12:47 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Wed Feb 15, 2012 12:19 pm
Posts: 1
Hi guys,
I struggled with this problem and found a solution to the problem. It is quite simple actually and I hope it will help you. Here is the link to my post:

You'll have to remove the empty space (%20) between "blog" and "spot", the address is at [URL banned].com.

http://msmwebdev.[URL banned].com/2012/02/force-raw-document-format-in-joomla.html

BR


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



Who is online

Users browsing this forum: No registered users and 11 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