Allen yes very well said this is exactly what I was planning on doing. LOL,
however, I may have talked the person I'm doing this with into moving the
site over to a server with CF.

Many thanks to you and to all for the responses on this. I really appreciate
it.

Dusty

On Fri, Apr 17, 2009 at 7:28 AM, <[email protected]> wrote:

>  There's really not a problem with doing what you say - many will say it's
> bad practice, but a way to avoid getting all the bad practice responses, do
> something like this.  Have a function in your cfc that returns your query.
> Then have another function that will format that particular query into an
> html table.  That will do two things for you.  One, you can separate your
> data layer from your display layer, and if in the future you feel that you
> need that query for more than just displaying HTML tables, you can easily
> just call that function.
>
> So no, there's no problem with wanting to just return an HTML table.  You
> can do that, just separate out your data function and your html formatting
> functions.  Give that a shot.
>
> As John said below, from php you would just call the page as follows:
> http://url_to_cfc/yourcfc.cfc?methodname=yourmethod  - be sure to get rid
> of the returnFormat=json if you're going to be outputting html.
>
> Allen
>
>  ------------------------------
> *From:* [email protected] [mailto:[email protected]] *On Behalf Of *Dusty Hale
> *Sent:* Thursday, April 16, 2009 6:37 PM
> *To:* [email protected]
>
> *Subject:* Re: [ACFUG Discuss] creating a web service with cf
>
> I guess my thought was that I didn't want to deal with a php array. I don't
> have so much php experience so I was hoping to just output (or echo) that
> one variable that would be returned all formatted into HTML for presentation
> on the page. This would allow me to do pretty much all the work with CF.
> Does that make any sense?
>
> The main reason I am thinking this way is because I feel comfortable coding
> with CF but not so comfortable with PHP and it is something I don't want to
> spend very much time on.
>
> Dusty
>
>
> On Thu, Apr 16, 2009 at 6:01 PM, John Mason <[email protected]> wrote:
>
>> You're adding a lot more work to this than is necessary. Just call the cfc
>> method (which will return a standard query) like so..
>>
>> url_to_cfc/yourcfc.cfc?methodname=yourmethod&returnFormat=json
>>
>> This should provide you with a proper json string. Then on the php side
>> use json_decode() to decode the string into a php array. You should be good
>> too go with that and it'll take a lot less work.
>>
>> John
>> [email protected]
>>
>>
>> Dusty Hale wrote:
>>
>>> Hi thank you Allen, John, and Brooks for the responses. I was actually
>>> planning on keeping the query result in the cfc and formatting the results
>>> in HTML table rows and pushing that into a <cfsavecontent
>>> variable="myresults"> and then sending that returning that variable to the
>>> web service. So in PHP I was hoping to just spit out that variable somehow
>>> to display the results in the HTML table rows.
>>>
>>> Does that sound like it would work? Can anyone see any problems with
>>> doing it this way. Security is not too much of an issue here it is just some
>>> categories of sponsor information.
>>>
>>> Muchos Gracias,
>>>
>>> Dusty
>>>
>>> On Thu, Apr 16, 2009 at 10:36 AM, <[email protected] <mailto:
>>> [email protected]>> wrote:
>>>
>>>    You can simply specify the return type as either wddx or json. PHP
>>>    has (or at least had) a wddx reader. And json is common now, so I
>>>    suspect php has functions for that as well. If you do specify the
>>>    return type, do it in the url not on the attribute of the
>>>    cffunction. It keeps your web service agnostic so to speak.
>>>
>>>    John
>>>    [email protected] <mailto:[email protected]>
>>>
>>>
>>>    ----- Original Message -----
>>>    From: [email protected] <mailto:[email protected]>
>>>    [mailto:[email protected] <mailto:[email protected]>]
>>>    To: [email protected] <mailto:[email protected]>
>>>    Sent: Thu, 16 Apr 2009 08:01:21 -0400
>>>    Subject: Re: [ACFUG Discuss] creating a web service with cf
>>>
>>>    sure - but you need to decide on a data format. does php support
>>>    cf query
>>>    type? i doubt it - you will likely need to change the query to an
>>>    array.
>>>
>>>
>>>
>>>
>>>    Dusty Hale <[email protected] <mailto:[email protected]>>
>>>    Sent by: [email protected] <mailto:[email protected]>
>>>    04/16/2009 01:02 AM
>>>    Please respond to
>>>    [email protected] <mailto:[email protected]>
>>>
>>>
>>>    To
>>>    [email protected] <mailto:[email protected]>
>>>
>>>    cc
>>>
>>>    Subject
>>>    [ACFUG Discuss] creating a web service with cf
>>>
>>>
>>>
>>>
>>>
>>>
>>>    I have a need which I think would be a good fit to create a web
>>>    service
>>>    but since I have never developed a web service I thought to get
>>>    some other
>>>    opinions.
>>>
>>>    I have a site which is hosted on a Linux box with php and no CF. I
>>>    need
>>>    for part of this site to use a database and make a little admin app to
>>>    manage it. Well I am lazy and don't want to do this with PHP and MySQL
>>>    mainly because I know CF and SQL so I just want to do this with
>>>    what I am
>>>    used to. So my thought was that I could create a CFC that would
>>>    act as a
>>>    web service that the PHP site could call remotely. All it needs to
>>>    do is
>>>    get some data from the SQL server and display it in HTML. So I
>>>    though I
>>>    could generate the result HTML in the CFC and the PHP site could
>>>    call it
>>>    remotely. Again the PHP site is not on the same server as the CFC
>>>    so it
>>>    would be a remote call.
>>>
>>>    This is basically what a web service is for right? Would this approach
>>>    work?
>>>
>>>    Thanks so much in advance for any replies.
>>>
>>>    Dusty
>>>
>>>
>>>
>>>    -------------------------------------------------------------
>>>    To unsubscribe from this list, manage your profile @
>>>    http://www.acfug.org?fa=login.edituserform
>>>
>>>    For more info, see http://www.acfug.org/mailinglists
>>>    Archive @ http://www.mail-archive.com/discussion%40acfug.org/
>>>    List hosted by http://www.fusionlink.com
>>>    -------------------------------------------------------------
>>>
>>>
>>>
>>>
>>>    -------------------------------------------------------------
>>>
>>>    To unsubscribe from this list, manage your profile @
>>>
>>>    http://www.acfug.org?fa=login.edituserform
>>>
>>>
>>>
>>>    For more info, see http://www.acfug.org/mailinglists
>>>
>>>    Archive @ http://www.mail-archive.com/discussion%40acfug.org/
>>>
>>>    List hosted by http://www.fusionlink.com
>>>
>>>    -------------------------------------------------------------
>>>
>>>
>>>
>>>
>>>
>>> --
>>> Dusty Hale
>>> Email: [email protected]
>>> Phone (Atlanta): 404.474.3754
>>> Phone (Toll Free USA): 877.841.3370
>>> Website: www.DustyHale.com <http://www.DustyHale.com>
>>>
>>
>>
>>
>> -------------------------------------------------------------
>> To unsubscribe from this list, manage your profile @
>> http://www.acfug.org?fa=login.edituserform
>>
>> For more info, see http://www.acfug.org/mailinglists
>> Archive @ http://www.mail-archive.com/discussion%40acfug.org/
>> List hosted by http://www.fusionlink.com
>> -------------------------------------------------------------
>>
>>
>>
>>
>
>
> --
> Dusty Hale
> Email: [email protected]
> Phone (Atlanta): 404.474.3754
> Phone (Toll Free USA): 877.841.3370
> Website: www.DustyHale.com
>
> -------------------------------------------------------------
> To unsubscribe from this list, manage your profile @
> http://www.acfug.org?fa=login.edituserform
>
> For more info, see http://www.acfug.org/mailinglists
> Archive @ http://www.mail-archive.com/discussion%40acfug.org/
> List hosted by FusionLink <http://www.fusionlink.com>
> -------------------------------------------------------------




-- 
Dusty Hale
Email: [email protected]
Phone (Atlanta): 404.474.3754
Phone (Toll Free USA): 877.841.3370
Website: www.DustyHale.com

Reply via email to