Returning ONLY the data from a function, not all the joomla code...

Have a programming question regarding your component, plug-in, extension or core hacks? Have an interesting tidbit, FAQ or programming tip you’d like to share? This is the place for you.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Post Reply
User avatar
fire2006
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Tue Jun 06, 2006 7:46 am
Location: Seoul
Contact:

Returning ONLY the data from a function, not all the joomla code...

Post by fire2006 » Thu Aug 30, 2007 12:21 pm

hi there, I have a function in my component that is being called by an http request from another program, I need to return a simple value to my program and not all the joomla code,

any ideas how I can do this?
Paul Preibisch - Educational Technologist
Fire Centaur - English Village - Secondlife
http://slurl.com/secondlife/English%20V ... 20Village&

User avatar
seadap
Joomla! Intern
Joomla! Intern
Posts: 95
Joined: Mon Dec 04, 2006 12:22 am
Contact:

Re: Returning ONLY the data from a function, not all the joomla code...

Post by seadap » Thu Aug 30, 2007 3:13 pm

I'm not quite sure how to implement this idea but I figured I'd throw it out there.  You could use something like an rss feed to return an xml file that your program could parse to get the data you want.

Also, failing that, you could scrape the data you need out of the joomla code by searching for a token that marks the beginning and ending of the data you want..

Just a couple of ideas.  I'm sure there's an easy way to do what you're looking for.
Knowledge is realizing that the street is one-way, wisdom is looking both directions anyway.

User avatar
fire2006
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Tue Jun 06, 2006 7:46 am
Location: Seoul
Contact:

Re: Returning ONLY the data from a function, not all the joomla code...

Post by fire2006 » Thu Aug 30, 2007 3:39 pm

nice thanks man,

But I think I got it!  Basically, all I need to do is create a tempalte that only has:





Then, i need to create a menu item for the component, and then assign that template for it, that yields only the data I need!  Cheers!
Paul Preibisch - Educational Technologist
Fire Centaur - English Village - Secondlife
http://slurl.com/secondlife/English%20V ... 20Village&

User avatar
fire2006
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Tue Jun 06, 2006 7:46 am
Location: Seoul
Contact:

where does come from? and how do I get rid of it?

Post by fire2006 » Thu Aug 30, 2007 4:18 pm

I just noticed, when I view source, it's not completely bare - I still see a strange comment

""

where does come from? and how do I get rid of it?
Paul Preibisch - Educational Technologist
Fire Centaur - English Village - Secondlife
http://slurl.com/secondlife/English%20V ... 20Village&

User avatar
DeanMarshall
Joomla! Apprentice
Joomla! Apprentice
Posts: 46
Joined: Fri Aug 19, 2005 2:26 am
Location: Lancaster, Lancashire, United Kingdom
Contact:

Re: Returning ONLY the data from a function, not all the joomla code...

Post by DeanMarshall » Sat Sep 01, 2007 11:39 pm

It looks from your previous comments like you are using Joomla 1.0.x
This forum is aiming - I think - at the Joomla 1.5 branch.

One other method that will work with Joomla 1.0.x is to link to index2.php rather than index.php
this should output just the components output without any superfluous formatting.

Dean
Dean Marshall - http://www.deanmarshall.co.uk/
Mambo and Joomla Consultant

Add an Amazon Store to your site: http://www.Project-TinA.com/
(coming soon)

User avatar
fire2006
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Tue Jun 06, 2006 7:46 am
Location: Seoul
Contact:

Re: Returning ONLY the data from a function, not all the joomla code...

Post by fire2006 » Sun Sep 02, 2007 5:06 am

Thanks for  catching this Dean, you are right - I am using joomla 1.0.13

Cheers!
Paul Preibisch - Educational Technologist
Fire Centaur - English Village - Secondlife
http://slurl.com/secondlife/English%20V ... 20Village&

User avatar
ianmac
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 237
Joined: Sat Sep 24, 2005 11:01 pm
Location: Toronto, Canada

Re: Returning ONLY the data from a function, not all the joomla code...

Post by ianmac » Sun Sep 02, 2007 12:30 pm

Also,
you will want to pass on the request string: &no_html=1

Ian
Help test my Component XML Generator Tool!
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,1997/Itemid,35/
All feedback appreciated!

User avatar
jalil
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 128
Joined: Wed Jul 04, 2007 4:54 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Returning ONLY the data from a function, not all the joomla code...

Post by jalil » Tue Sep 11, 2007 3:33 am

DeanMarshall wrote:It looks from your previous comments like you are using Joomla 1.0.x
This forum is aiming - I think - at the Joomla 1.5 branch.

One other method that will work with Joomla 1.0.x is to link to index2.php rather than index.php
this should output just the components output without any superfluous formatting.
Dean


this forum is ? where should 1.0 coding discussions be held, i need to start with 1.0, then speed to 1.5

btw fire2006, i use the same method you thought of to get pure text menus for mobiles and it works a treat. just so you know you are on the right track.


Post Reply