jimport('joomla.filter.output'); resulting in Class 'JOutputFilter' not found

Discussion and education for beginner / novice programmers interested in embarking on the development process to take advantage of the extensible nature of the Joomla! CMS.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Forum rules
Post Reply
reashlin
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Mon Dec 03, 2007 11:23 am

jimport('joomla.filter.output'); resulting in Class 'JOutputFilter' not found

Post by reashlin » Mon Dec 03, 2007 4:10 pm

Hey,

Now i'm very confused.

I have this code

Code: Select all

// Some code
<?php
jimport('joomla.filter.output');
$k=0;
for ($i = 0, $n=count( $rows ); $i < $n; $i++) {
$row = &$rows[$i];
$checked = JHTML::_( 'grid.id', $i, $row->id );
$published = JHTML::_( 'grid.published', $row, $i );
$link = JOutputFilter::ampReplace( 'index.php?option=' . $option . '&task=edit&cid[]=' . $row->id );
?>
// Some code


when I try and open the page all I get is

Code: Select all

Fatal error: Class 'JOutputFilter' not found in /home/mglexis/public_html/Joomla 1.5/administrator/components/com_reviews/admin.reviews.html.php on line 89


can anyone tell me what is going wrong
Last edited by reashlin on Fri Dec 07, 2007 1:33 pm, edited 1 time in total.

kdevine
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Thu Mar 02, 2006 8:38 pm
Location: Baltimore, MD

Re: jimport('joomla.filter.output'); resulting in Class 'JOutputFilter' not foun

Post by kdevine » Mon Dec 03, 2007 4:15 pm

You are loading the right file unfortunately you have the wrong class name in your code. The class name is JFliterOutput.

reashlin
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Mon Dec 03, 2007 11:23 am

Re: jimport('joomla.filter.output'); resulting in Class 'JOutputFilter' not found

Post by reashlin » Mon Dec 03, 2007 4:55 pm

Cheers again,

I actually found that after some hunting in the API (I missed it the first two times I looked) and was about to come here and say not to worry.

:-[

Cheers.

User avatar
CirTap
Joomla! Intern
Joomla! Intern
Posts: 73
Joined: Mon Dec 12, 2005 5:34 pm
Contact:

Re: jimport('joomla.filter.output'); resulting in Class 'JOutputFilter' not foun

Post by CirTap » Tue Dec 04, 2007 9:23 am

Hi,

the "Filter" package has gone through several changes and your code is not the most recent and will fail (again) should you update from SVN or the next RC to come.
It once was:
- /filter/output,php  JOutputFilter
- /filter/input,php  JInputFilter
then became what you have now (matching the general naming schema of the framework):
- /filter/output,php  JFilterOutput
- /filter/input,php  JFilterInput
and now is ("breaking" the schema once more):
- /filter/filteroutput,php  JFilterOutput
- /filter/filterinput,php  JFilterInput

thus after your next update, you need to change your code into
  jimport('joomla.filter.filteroutput');
to match the new filename.

I have no idea why they were changed again, for no obvious reason ...

Have fun,
CirTap
You can have programs written fast, well, and cheap, but you only get to pick 2 ...

"I love deadlines. I like the whooshing sound they make as they fly by." Douglas Adams

reashlin
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Mon Dec 03, 2007 11:23 am

Re: jimport('joomla.filter.output'); resulting in Class 'JOutputFilter' not found

Post by reashlin » Tue Dec 04, 2007 12:20 pm

Cheers for the heads up.

I will make a note of that.

Bozzy

Re: jimport('joomla.filter.output'); resulting in Class 'JOutputFilter' not foun

Post by Bozzy » Wed Jan 02, 2008 9:41 pm

Hi,

I'm working on the same Tutorial like reashlin and have the same problem. I changed the JFilterOutput syntax like described.
Like you perhaps see, the user should be able to edit a row of a database entry in a component by clicking on the entry name alternative to checkbox the entry and click "Edit".
But this does not work quite well: The Buttons of "Save", "Apply" and "Cancel" are shown in the top right but instead of showing the edit fields, the default overview of the database table with its entries from the pre-screen is shown.

What can this be ???
Thanks

esedic
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Wed Dec 27, 2006 1:55 pm

Re: jimport('joomla.filter.output'); resulting in Class 'JOutput

Post by esedic » Wed Feb 20, 2008 2:40 pm

Hi, probably you guys are working on example code from Learning Joomla! 1.5 Extension Development as I noticed that it's the com_reviews component which is a example component to build in this book.

I had the same problems, first with JFilterOutput class, then I noticed the same problem as Bozzy had.

I've seen that this book was published in May 2007, is it a problem of Joomla version in time that this book was written?

I was really looking forward to learn developing Joomla extensions but following this book's example is pretty hard, with all the corrections I had to make.

User avatar
CirTap
Joomla! Intern
Joomla! Intern
Posts: 73
Joined: Mon Dec 12, 2005 5:34 pm
Contact:

Re: jimport('joomla.filter.output'); resulting in Class 'JOutput

Post by CirTap » Wed Feb 20, 2008 11:44 pm

esedic wrote:I've seen that this book was published in May 2007, is it a problem of Joomla version in time that this book was written?
it definitely is.
In May '07, Joomla! was still in Beta 2 and it took another nine months for Joomla! to become final - new lifeforms come into being in this very period of time :-)
Everything can change in a pile of code labeled with beta. Some publishers, however, thought it'd be a brilliant (marketing) idea to (probably) urge their authors finish a book about an unfinished product. I didn't read this particular book (in fact never any J! book), but a statement like "all the corrections I had to make" tells me that this "early bird" issue, was a pretty bad deal. Not for this publisher of course, but if you're lucky, they have provided updated material on their website you may download -- they have a special area for errata.
It takes at least two months to proofread, copy-edit, layout, lecture, verify, and finally print such books. If this was released in May, the information is probably current as of February or March '07 -- that's one year old stuff. The pace of changes in behavior and appearance of the two main applications and the framework structure and API in particular, cannot be covered correctly in any book published before, let's say, Dez. '07. (My humble opinion of course.)
I think there have been at least three different versions of the back-end since Sept. '05 until we got what we have and see today; Beez wasn't even close, and several parts of the code (and documentation) up until early '07 meanwhile became literally useless. It's those tiny little details like a renamed class, a file moved, that can cause so much frustration.
<sigh>

To quote an honorable member of the Joomla! Community:
When you think you've got something well documented, those pesky devs go and change it.
:D

We are lucky to create [easy to modify] digital documents :-) -- unlike those book-makers.
It remains a very time consuming job to review all the many online documentation that was written then and that is written today. The condition online probably led you (guys) to buy a book for offline reading which, unfortunately, isn't accurate either.

But isn't it great to have the online-fora so you can "utilize the wealth of knowledge our community provides"? :D

Have fun,
CirTap

(Don't get me wrong: this isn't a rant about books or even about this publisher. I love books -- flipping pages in a comfy chair... if it's a novel. I didn't buy any computer book for at least a decade because each and every book I'd spent by precious money for always turned out to contain substantial errors, some so tremendous to drive me nuts, wasting my time only to find out it's them being faulty and outdated, and not me being a stupid.)
You can have programs written fast, well, and cheap, but you only get to pick 2 ...

"I love deadlines. I like the whooshing sound they make as they fly by." Douglas Adams

goodman123
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Sun Dec 24, 2006 7:53 pm

Re: jimport('joomla.filter.output'); resulting in Class 'JOutput

Post by goodman123 » Sat Feb 23, 2008 8:33 pm

I don't know if this is related. After I installed com_tutorials on joomla 1.5.1. and started to submit a link on the frontpage, I got this error:
Fatal error: Class 'InputFilter' not found in components/com_tutorials/tutorials.class.php on line 73
I am clueless as to how to fix the problem.

User avatar
CirTap
Joomla! Intern
Joomla! Intern
Posts: 73
Joined: Mon Dec 12, 2005 5:34 pm
Contact:

Re: jimport('joomla.filter.output'); resulting in Class 'JOutput

Post by CirTap » Sun Feb 24, 2008 1:37 pm

goodman123 wrote: Fatal error: Class 'InputFilter' not found in components/com_tutorials/tutorials.class.php on line 73
wow, "InputFilter" is even older than any of the "J*Filter" stuff.
In line 73 change "InputFilter::" to "JFilterInput::" -- there might be more places where you need to change this, search in all the .php files that come with this component.
Similar change "OutputFiler::" to "JFilterOutput::" if there are any.

In any of the .php files you should find calls to jimport( ".." ) where the string value contains "inputfilter" and maybe "outputfilter" -- I can't recall the old string format when the filters where not yet part of the joomla/ subfolders. However, those line should now read:
jimport( 'joomla.filter.filterinput' );
jimport( 'joomla.filter.filteroutput' );
You may run into other "old" tutorials or example code that uses outdated locations.
Here's how you can fix it: these dot-separated strings equal the pathname to individual files located in the /libraries folder. jimport() translates the string into a full-qualified path such as "/webroot/htdocs/libraries/joomla/filter/filterinput.php" (which is to solve one of the troubles of "safe-mode")

It may happen that you run into sth. like this, too: "joomla.file.*" -- this means, load all files from the /joomla/file subdirectory for instance.
Some older "plugin" examples may use this and will now fail, because the "event handler" code was once part of the "/libraries/joomla/plugin" folder but has since moved to "/libraries/joomla/event".
Code using the "JEventDispatcher" class now needs to use "JDispatcher" -- jimport("joomla.event.dispatcher")

There might be other glitches, but these tips should help you to iron them out and get the code running.

If the code was found in the documentation wiki, please report any errors (and possible fixes on how you solved it) in the Developer Documentation Forum so we can fix this, and sorry for the inconvenience.

Have fun,
CirTap
You can have programs written fast, well, and cheap, but you only get to pick 2 ...

"I love deadlines. I like the whooshing sound they make as they fly by." Douglas Adams

goodman123
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Sun Dec 24, 2006 7:53 pm

Re: jimport('joomla.filter.output'); resulting in Class 'JOutput

Post by goodman123 » Sun Feb 24, 2008 5:42 pm

CirTap, thank you very much for your detailed reply. I will definitely give it a try.

pmuruaga

Re: jimport('joomla.filter.output'); resulting in Class 'JOutput

Post by pmuruaga » Mon Mar 03, 2008 10:36 pm

So People, what do you do with the tutorial, I was doing the same: Learning Joomla Extensions... and I had all the same problems you have, but it is good to read some book like this where you can go trough the chapters learning step by step. But it is sooo frustrating to get to more than a half of the book and can finish it. What can you recomend my to do? try other good book/tutorial? wich one? try to finish it? (I think it want be easy without doing the example). I don't know. I wanna learn to develop. Please masters of joomla, help us!!! :o

User avatar
CirTap
Joomla! Intern
Joomla! Intern
Posts: 73
Joined: Mon Dec 12, 2005 5:34 pm
Contact:

Re: jimport('joomla.filter.output'); resulting in Class 'JOutput

Post by CirTap » Tue Mar 04, 2008 5:43 pm

Hi,
all I can suggest is to contact the publisher and ask for an errata or any other kind of "digital" update -- if available. Depending on the book's success (== sales) you might be lucky and such things exists (typically involves additional work from the author ~ payments ~ costs. Good sales = high probability for a second editon <g>)
Maybe the eBook edition is more up to date; maybe not.
Maybe you get a rabate for an updated eBook edition if you can convice the publisher that you own the printed book (which was obviously released way too early to be of any good use.)
According to their website, the "Building Websites with J! 1.5 Beta 1" book includes Free eBook upgrades up to 1.5 Final Release -- maybe they offer the same for the "Learning Joomla! 1.5 Extension Development".
Just ask :)

For this particular book, head over to http://www.packtpub.com/support , select the book's title from the list and get the updated code samples (dated 28 June 2007). I have no idea if the contents in this download are any "better" than the printed stuff or code samples that came on the CD (if there was one included) and whether that code will work with the recent release (1.5.1): I don't own that book nor have I even seen it in real life :-)

I already mentioned earlier that, imho, any book published before Dec. '07 will have a "lack of correctness" -- simply put: the older, the "worse". If you wanna learn and study code using a (printed) book, you simply need a more recent issue.

Good luck & have fun,
CirTap
You can have programs written fast, well, and cheap, but you only get to pick 2 ...

"I love deadlines. I like the whooshing sound they make as they fly by." Douglas Adams


Post Reply