Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Stationwagon
  • Stationwagon is a Fuel-based blog application. The basic idea behind this application is to show you how things work by using different classes in Fuel. Features
    - Auth (signup and login)
    - Articles (list, add, edit, delete)
    - Categories (list, add, edit, delete) Upcoming
    - User Groups (User/Admin)
    - Comments
    - Drafts
    - Articles View
    - WYSIWYG editor The application uses packages like ActiveRecord and Auth, and classes like Pagination. You can go ahead and get the source from GitHub, and if you'd like to contribute just fork the repo and do a pull request if you have anything to contribute.
  • I've downloaded and installed Stationwagon, however I couldn't find the database.sql file? I've used the SQL posted by PaulboCo but had to change the table names, now it's not recognising some of the fields... can anyone point me in the right direction of the database.sql file please? Thanks
  • Looks great, will be really helpful in learning how to use Fuel. Is there a reason you decided to post the SQL itself rather than use Fuel's migrations?
  • Thanks, that fixed the problem... Now for second problem... If I try to change a Draft to Published using the Draft link under status column, I'm redirected to login page and receive a white page.... (something to do with cookie)... This code in common.php causes the redirect...
    if ($access != true)
            {
                Response::redirect('users/login');
            }
    
    If I disable this I get...
    Notice: Undefined property: Controller_Articles::$user_id in APPPATH/classes/controller/articles.php @ line 127
    
    This is the line in question:
    $article = Model_Article::find_by_id_and_user_id($id, $this->user_id);
    

    Dealing with the first part... why is it not allowing access (if ($access != true))?
  • https://github.com/abdelm/stationwagon/blob/master/fuel/app/classes/controller/users.php on line 44.
    $this->template->content = View::factory('users/signup')
    ->set('val', Validation::instance('signup_user'), false); just wondering whats the code in bold does?
  • In Fuel we have "Output filtering" instead of input filtering by default (you can switch this if you want in app/config/config.php), this means that anything passed to the view gets pushed through htmlentities to prevent XSS. Dan explained both on his blog. Objects will either have all their properties filtered or are converted to strings to be filtered when they have a __toString method. (the exception to this are objects of class View, ViewModel or Closures - and any you might whitelist yourself) Because they want to have the validation object in their view, but not filtered or cast to a string they pass it using the View::set() method with false as its last param. That switches off the filtering for the variable they're setting, thus allowing them to pass the Validation object.
  • Jelmer Schreuder wrote on Tuesday 5th of April 2011:
    In Fuel we have "Output filtering" instead of input filtering by default (you can switch this if you want in app/config/config.php), this means that anything passed to the view gets pushed through htmlentities to prevent XSS. Dan explained both on his blog. Objects will either have all their properties filtered or are converted to strings to be filtered when they have a __toString method. (the exception to this are objects of class View, ViewModel or Closures - and any you might whitelist yourself) Because they want to have the validation object in their view, but not filtered or cast to a string they pass it using the View::set() method with false as its last param. That switches off the filtering for the variable they're setting, thus allowing them to pass the Validation object.

    Thanks Jelmer :)
  • Import the database.sql to your database

    There is no database.sql.
  • @Nique - This should work...
    DROP TABLE IF EXISTS `sw_simpleusers`;
    
    CREATE TABLE `sw_simpleusers` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `username` varchar(50) DEFAULT NULL,
      `password` varchar(50) DEFAULT NULL,
      `email` varchar(70) DEFAULT NULL,
      `profile_fields` text,
      `group` int(11) DEFAULT NULL,
      `last_login` bigint(20) DEFAULT NULL,
      `login_hash` tinytext,
      PRIMARY KEY (`id`),
      UNIQUE KEY `username` (`username`),
      UNIQUE KEY `email` (`email`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
    
    
    DROP TABLE IF EXISTS `sw_articles`;
    
    CREATE TABLE `sw_articles` (
      `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
      `user_id` int(11) unsigned NOT NULL DEFAULT '0',
      `category_id` int(11) DEFAULT NULL,
      `title` varchar(140) COLLATE utf8_unicode_ci DEFAULT NULL,
      `body` text COLLATE utf8_unicode_ci,
      `published` tinyint(3) unsigned NOT NULL DEFAULT '0',
      `created_time` bigint(20) unsigned DEFAULT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
    
    
    DROP TABLE IF EXISTS `sw_categories`;
    
    CREATE TABLE `sw_categories` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `user_id` int(11) unsigned NOT NULL DEFAULT '0',
      `name` varchar(140) COLLATE utf8_unicode_ci DEFAULT NULL,
      `description` tinytext COLLATE utf8_unicode_ci,
      `created_time` bigint(20) DEFAULT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
    
  • I don't know if anyone else has reported this or not, but the logic within your edit controllers is flawed. If you submit the edit form, but one of the fields fails validation, you lose everything you just typed in, and instead are shown the data that's in the database.
  • Hello AbdelRahman, thanks for your stationwagon, good for starting FuelPHP. I need your help, regarding authentication. if this is possible to convert it to RESTful, secondly, can work also in Ajax. there is one sample available, from this link : http://saaboke.com/?p=257 but I cannot make it run, errors appearing. so if you could help then this is also great for FuelPHP community in general. btw im newbie to Fuelphp, I am a migrant from CI2. looking forward to receiving your help, Best regards,
  • Installed and works great but had to make a few adjustments, to make it work as right out of the box so to say it had errors below is the errors I found and fixed...
    in app\config\config.php line 123 I simply commented out but I suppose you could just delete.
    <<<<<<< HEAD
    
    Line 126 Again i simply commented out
    =======
    

    Line 128 Again commented out
    >>>>>>> f488a6dcdcb7a7da6527f0e54dee2d666de6790c
    
    and the database sql file you have sw_simpleusers as a table when you are calling sw_users in your coding so changing the table to sw_users fixes that issue.
  • I'm falling down on step zero.
    Where do I put the files?
    Seems like the download includes fuel.
    Or should I copy the stuff into fuel and trust whatever overwrites... I know nothing of fuel.
    I do know CI, and I'm interested in this ORM stuff.
    But unsure how this stuff is laid out.
    Want to see a working sample ....
    The intro page is a little light...
  • Clicking of the 'Drafts' link (stationwagon/public/index.php/users/login) results in:
    Firefox has detected that the server is redirecting the request for this address in a way that will never complete... Adding a category works but reports:
    Notice!
    
    ErrorException [ Notice ]: Undefined index: name
    
    COREPATH/classes/form.php @ line 227:
    
    226: &#123;
    227: $attributes['id'] = \Config::get('form.auto_id_prefix', 'form_').$attributes['name'];
    228: }
    

  • I dont get why you have the same views for user in the modules and the main view folder.
  • Thanks for this release! One thing though: the sw_articles table is missing the published field, which should be an integer (an error is thrown if you try to save an unpublished article.) :)
  • Can't run the application Warning: require_once(E:\projects\websites\stationwagon\fuel\core\bootstrap.php) [function.require-once]: failed to open stream: No such file or directory in E:\projects\websites\stationwagon\fuel\app\bootstrap.php on line 4
  • Then you have a serious issue with your setup, as fuel/core contains the bootstrap as part of Fuel (it doesn't work without it).
  • Are you referring to Stationwagon or Ninjarite-blog? If it's Ninjarite, you can fork a repo, and make pull requests :)
  • When using the latest version of both Stationwagon (1.0.3) and Fuel (1.0-RC2) I had to change the following in fuel/app/config/db.php: from
    Fuel::DEVELOPMENT => array(
    to
    'dev' => array( the same goes for every instance of "FUEL::" in that file.
  • David MacLean wrote on Thursday 28th of July 2011:
    I'm falling down on step zero.
    Where do I put the files?
    Seems like the download includes fuel.
    Or should I copy the stuff into fuel and trust whatever overwrites... I know nothing of fuel.
    I do know CI, and I'm interested in this ORM stuff.
    But unsure how this stuff is laid out.
    Want to see a working sample ....
    The intro page is a little light...

    Start by reading all the docs : http://fuelphp.com/docs
  • It is showing redirect loop error in users/login when using 1.0rc3
  • Chris Arnold wrote on Tuesday 26th of July 2011:
    I've downloaded and installed Stationwagon, however I couldn't find the database.sql file? I've used the SQL posted by PaulboCo but had to change the table names, now it's not recognising some of the fields... can anyone point me in the right direction of the database.sql file please? Thanks
    Sorry about that, the database.sql should be available in the repo now.
  • We currently have a blog module under development. You can check it out in the develop branch at http://github.com/ninjarite/fuelmod-blog If you care to check it out it's developed as a reusable module under rc3
  • A Huzz wrote on Saturday 9th of April 2011:
    Can't run the application Warning: require_once(E:\projects\websites\stationwagon\fuel\core\bootstrap.php) [function.require-once]: failed to open stream: No such file or directory in E:\projects\websites\stationwagon\fuel\app\bootstrap.php on line 4

    Same problem here... When I install a fresh copy of phpfuel the welcome message works though
  • The fix for the notice on the category add/edit pages is to change the form::submit tags to the following:
    /* /fuel/app/views/categories/add.php (line 23) */
    <?php echo Form::submit('add_category', 'Add Category'); ?>
    
    /* /fuel/app/views/categories/edit.php (line 23) */
    <?php echo Form::submit('edit_category', 'Edit Category'); ?>
    

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion