JDocument->getInstance('raw') not working as intended?
Moderator: ooffick
Forum rules
Please use the official Bug Tracker to report a bug: https://issues.joomla.org
Please use the official Bug Tracker to report a bug: https://issues.joomla.org
- Bakual
- Joomla! Ace
- Posts: 1038
- Joined: Sun Dec 13, 2009 9:00 pm
- Location: Switzerland
- Contact:
JDocument->getInstance('raw') not working as intended?
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?
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?
- mcsmom
- Joomla! Exemplar
- Posts: 7897
- Joined: Thu Aug 18, 2005 8:43 pm
- Location: New York
- Contact:
Re: JDocument->getInstance('raw') not working as intended?
This might be useful for you:
http://docs.joomla.org/Xml-rpc
(It's really about all document types.)
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!.
http://officialjoomlabook.com Get it at http://www.joomla.org/joomla-press-official-books.html Buy a book, support Joomla!.
- Bakual
- Joomla! Ace
- Posts: 1038
- Joined: Sun Dec 13, 2009 9:00 pm
- Location: Switzerland
- Contact:
Re: JDocument->getInstance('raw') not working as intended?
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:
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
In J1.5 I could use the following code in my controller to force the document type "raw" for my 'feed' view:
Code: Select all
// 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 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
- oasisfleeting
- Joomla! Enthusiast
- Posts: 114
- Joined: Sun Jan 13, 2008 1:46 am
- Contact:
Re: JDocument->getInstance('raw') not working as intended?
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.
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
- Bakual
- Joomla! Ace
- Posts: 1038
- Joined: Sun Dec 13, 2009 9:00 pm
- Location: Switzerland
- Contact:
Re: JDocument->getInstance('raw') not working as intended?
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.
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.
- oasisfleeting
- Joomla! Enthusiast
- Posts: 114
- Joined: Sun Jan 13, 2008 1:46 am
- Contact:
Re: JDocument->getInstance('raw') not working as intended?
I understand now. What about trying to force the raw view like this in the controllerBakual 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.
Code: Select all
if (some case that turns out to be true){
// Changing the podcast format to raw output
JRequest::setVar('view','myview');
JRequest::setVar('format','raw');
}
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
- Bakual
- Joomla! Ace
- Posts: 1038
- Joined: Sun Dec 13, 2009 9:00 pm
- Location: Switzerland
- Contact:
Re: JDocument->getInstance('raw') not working as intended?
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.
- oasisfleeting
- Joomla! Enthusiast
- Posts: 114
- Joined: Sun Jan 13, 2008 1:46 am
- Contact:
Re: JDocument->getInstance('raw') not working as intended?
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.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.
Check out my joomla extensions at www.acoolsip.com
- Bakual
- Joomla! Ace
- Posts: 1038
- Joined: Sun Dec 13, 2009 9:00 pm
- Location: Switzerland
- Contact:
-
- Joomla! Intern
- Posts: 56
- Joined: Tue Aug 29, 2006 11:08 pm
- Contact:
Re: JDocument->getInstance('raw') not working as intended?
Did you ever find a Solution to this problem?
I'm experiencing the same problem with Joomla 1.7.
I'm experiencing the same problem with Joomla 1.7.
Joomla Hosting: https://www.helpinghost.com/joomla-hosting/
- Bakual
- Joomla! Ace
- Posts: 1038
- Joined: Sun Dec 13, 2009 9:00 pm
- Location: Switzerland
- Contact:
Re: JDocument->getInstance('raw') not working as intended?
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.
-
- Joomla! Intern
- Posts: 56
- Joined: Tue Aug 29, 2006 11:08 pm
- Contact:
Re: JDocument->getInstance('raw') not working as intended?
Thanks,
not pretty, but it will do for now.
not pretty, but it will do for now.
Joomla Hosting: https://www.helpinghost.com/joomla-hosting/
- stutteringp0et
- Joomla! Ace
- Posts: 1389
- Joined: Sat Oct 28, 2006 11:16 pm
- Location: Texas
- Contact:
Re: JDocument->getInstance('raw') not working as intended?
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.
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/profile/pr ... ails/18398
Honk if this signature offends you.
Honk if this signature offends you.
-
- Joomla! Fledgling
- Posts: 1
- Joined: Wed Feb 15, 2012 12:19 pm
Re: JDocument->getInstance('raw') not working as intended?
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/f ... oomla.html
BR
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/f ... oomla.html
BR