Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorraslam
     
    please help me create my first application.

    i have seen screencast. I have setup database but i can't create controllers.
    i'm on windows
    I have setup environment path variable
    i have downloaded a stable release in tar.gz file.
    i have put the folder on my webserver (WAMP) and accessed it by url. http://localhost/akproject
    web based setup started and i have passed the three steps. now the screen shows


    Getting started

    1.
    Use script/generate to create your models and controllers

    To see all available options, run it without parameters.
    2.
    Set up a default routes (config/routes.php) or edit the default controller (app/controllers/page_controller.php)


    after that i went in console and to this folder f:\wamp\www\akproject. i had run the command
    php script/generate controller Blog and it doesn't create the controller. nothing happens and command prompt returns back as it is.

    what can be the problem?
    • CommentAuthorsalavert
     

    put the line

    define('AK_ERROR_REPORTING_ON_SCRIPTS', E_ALL); 
    

    in "yourapp/config/config.php", try to execute "script/generate controller Blog" again to see if there is an error

    • CommentAuthorraslam
     
    it is strange. i get this error.

    F:\wamp\www\ncvacc>php script/generate controller Kiosk

    Fatal error: Call to undefined function mysql_connect() in f:\wamp\www\ncvacc\ve
    ndor\adodb\drivers\adodb-mysql.inc.php on line 347
    • CommentAuthorsalavert
     

    I don't know how to fix this problem but I found the same discussion here

    • CommentAuthorraslam
     
    no answer there too.

    someone should know about it.
    • CommentAuthorraslam
     
    Still no answer?

    Can any senior developer of Akelos advise on this matter?
    •  
      CommentAuthorichigo
     

    do you have more than one php version installed? that is what caused problems for me. try to find out the path to your wamp php version and use it to call the script again.

    • CommentAuthorraslam
     
    only one version installed. My webserver is a machine that carries my company's all web projects. There are lots of other php projects built on that maching. php version is 5.0.3

    problem is, mysql_connect() function is not recognized by akelos framework. however it works fine with other projects on the same machine. I have used Joomla, Zen-cart, osCommerce and similar other opensource solutions on the same machine. they all work fine.

    i have confirmed the database configurations in config.php file also.

    don't know whats going on...


    *Battousai*
    •  
      CommentAuthorichigo
     

    probably this thread on another forum could help you. it seems like someone has a quite similar problem

    •  
      CommentAuthorbermi
     

    raslam, you should check the path to your command line PHP binary by typing

    which php
    

    or

    env php -i
    

    it is quite possible that the PHP you've got linked to your apache is not the same than the included in your server PATH

    A php script/framework cannot remove runtime functions so it is certainly a non Akelos error. You've got 2 php's, and you should either change the shebang line on your scripts to your production php binary or you should move the strange php binary out of your path and link the known one.

    • CommentAuthorraslam
     

    thanks bermi,

    i have passed this step... now I have moved to

    Connection to the database failed. mysqlt://root:******@localhost/akelos
    

    that is posted by ichigo.

    • CommentAuthorraslam
     

    strange i set the database name to ncvacc and the config file created in folder akelos/config/config.php has the database name akelos. i have change it to mine but why it didn't pick my values from the database step of configuration wizard?

    • CommentAuthorjervis
     
    you should make sure that your server has the php-cli

    and I plus this int ubuntu just by typing :sudo apt-get install php5-cli

    now it works:)
    • CommentAuthorraslam
     
    i'm running on windows machine.
    • CommentAuthorjervis
     
    if windows ,you can add your PHP.exe to your PATH
    • CommentAuthorraslam
     
    i did, i have added in my PATH.

    Its a good framework but difficult to configure. I was trying it because it works on PHP 4. i ve learnt symfony framework which only works on PHP 5 but its lot easier to configure.
    • CommentAuthorjervis
     
    But I was so successfully, what's your problems now?
    you can actually try to use XAMPP
    • CommentAuthorraslam
     
    i have WAMP, i didn't try XAMPP... i don't know if XAMPP can help. perhaps i should give it a try.

    i really wanted to use akelos because of PHP 4 and as it also works on PHP 5, therefore it can help in future too. It has some things similar to symfony.

    anyway i'll download XAMPP and try it.

    thanks jervis... i'll look forward to your cooperation.
    • CommentAuthorraslam
     

    Hi,

    I'm back and well... I am quite successful with XAMPP. It was quite easy to setup with xamp. Also when i started the Blog project screen cast (by Bermi), I got stuck at adding new post. It was a strange error. i wasn't using akelos from SVN then I installed SVN and downloaded the latest version from the trunk. I proceeded further and i'm stuck at comments section of blog tutorial.

    Every thing was going fine and I followed it correctly. Problem is... my comments for a post aren't showing. After executing the comment installer, it has a statement

    Ak::import('post,comment');
    

    which relates comments with post, i think the problem is at this statement. first comment of post(1) is added to the table and I can see it but isn't showing up but that comment isn't showing up on post show action.

    I also added the Add Comment form and it posts correctly and adds a comment into database table but comment doesn't apprear.

    • CommentAuthorsalavert
     

    Please could you paste your code here http://akelos.pastebin.com?

    It will be easier to follow the problem and people can help you modifying your code

    • CommentAuthorraslam
     

    Ok salavert,

    I'm at my home now and don't have the code with me. i have created the blog application in my office. though lookin at the code i do remember the lines now. Ok, here goes:

    comment_installer.php

    function up_1() 
    {
      /* table creation code by the model generator */
      //the columns are id,body,post_id
    
      Ak::import('post,comment');
    
      $Post = new Post(1);
      $Post->comment->create(array('body'=>'I love my country'));
      $Post->save();
    }
    

    show.tpl of Post model:

    {loop post.comments}
      <hr />
      <p>{comment.body}</p>
    {end}
    

    If you still need more code then i'll be able to post it after exactly 12 hrs from now.

    • CommentAuthorraslam
     

    Alright, I figured out why comments didn't show up. Its these two lines that were missing in my blog controller.

    var $models = 'post,comment';
    

    And the second line in show action handler

    $this->post = $this->Post->find(@$this->params['id'], array('include'=>'comments'));
    

    The above line had missing 2nd argument for find() method. what exactly this "include" parameter does?

    • CommentAuthorsalavert
     

    Loads the associated comments for current Post, but it's not correct at all, you should write

    $this->Post = $this->Post->find(@$this->params['id'], array('include' => array('comments')));
    

    Or

    $this->Post = $this->Post->find(@$this->params['id']);
    $this->Post->comment->load();
    

    But last case is an extra sql request to db, but in some cases is useful.

    • CommentAuthorraslam
     

    thanks salavert to giving me an alternate. I don't know the framework yet so I wanted to know what include can do to have an idea where it can be utilized.

    now when i reached the testing section of screen cast and i ran unit test it failed at comment_installer.php

    function up_1()
    {
        /**/
        $this->createTable('comments', "
          id,
          body,
          post_id
        ");
        /**/
    
        Ak::import('post,comment');
    
        $Post = new Post(1);
        $Post->comment->create(array('body' => 'I love my country'));
        $Post->save();
    }
    

    Error says "Call to member function create on non-object". The line reference is the

    $Post->comment->create(array('body' => 'I love my country'));
    
    • CommentAuthorsalavert
     

    I tried this example and worked for me, did you already defined the relation between Post an Comment at

    ~/model/post.php
    ~/model/comment.php
    

    Or maybe becouse database is empty and Post with id 1 not exists

    $Post =& new Post(1);
    
    • CommentAuthorraslam
     

    Yes the relations are already defined. For ~/model/comment.php

    var $belongs_to = "post";
    

    For ~/model/post.php

    var $has_many = "comments";
    

    I think, even if the relations are already defined and post(1) does exist in database the comment create() method should work.

    • CommentAuthorsalavert
     

    And if you try with

    $Post =& Post->find(1, array('include' => array('comments') ));
    

    Or

    $Post =& new Post(1);
    $Post->comment->load();
    

    And later

    $Post->comment->create(array('body' => 'I love my country'));