To make an update on the situation:

I made the code work with the Array DataSource up to a point. The
problem right now is that it uses a $records array which is assigned
statically in the Model, like this:
<?php
class State extends AppModel {
        var $name = 'State';
        var $useDbConfig = 'local';
        var $displayField = 'name';
        //Here is where records are assigned to the array:
        var $records = array(
                array('id' => 1, 'name' => 'Alabama', 'abbr' => 'AL'),
                array('id' => 2, 'name' => 'Alaska', 'abbr' => 'AK'),
                array('id' => 3, 'name' => 'Arizona', 'abbr' => 'AZ')
        );
}
?>

The issue is that if I try to use a function inside the model (for
example, one I found to read a XML file and turn it into an array), I
get parsing errors from PHP.
So, I'm stuck. Where should I add that functionality? Should I edit
the datasource and have it read the XML from there?

On 10 feb, 16:00, Carlos Paparoni <[email protected]> wrote:
> Hi everyone, I'm new to CakePHP and started using it in hopes of
> developing a project assigned to me in a course at my university as
> quickly as possible.
>
> The project requires that I avoid the use of databases completely,
> relying on XML files (or rather, file) to load, display, add, remove,
> search and save data.
>
> However, Cake relies mostly on databases, and while I managed to
> actually avoid the use of any, and read the XML file, I don't know
> where to go from there. I completed the blog tutorial and adapted it
> for the project (mainly the index view), but that is what I have so
> far.
>
> I was searching online for a solution, but didn't find any (except for
> code snippets here and there about writing a XML DS from scratch). I
> thought about using the Array DataSource (since I can convert the XML
> file into an array) but don't really know how exactly to implement
> that.
>
> Any ideas or suggestions? I would really appreciate some help.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to