SitePoint Sponsor

User Tag List

Page 6 of 7 FirstFirst ... 234567 LastLast
Results 126 to 150 of 175
  1. #126
    Coding and Breathing CoderMaya's Avatar
    Join Date
    Feb 2008
    Location
    Atlit, Israel
    Posts
    470
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nope, not getting any notices either (E_ALL) with RC3. If you still see those notices in RC3 maybe you can show me your code?
    Learn about the new Retro Framework
    Code PHP the way it was meant to be coded!

  2. #127
    SitePoint Zealot Amenthes's Avatar
    Join Date
    Oct 2006
    Location
    Bucharest, Romania
    Posts
    143
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry, my mistake. It was the blog in RC1. RC3 seems to be OK.
    I'm under construction | http://igstan.ro/

  3. #128
    Coding and Breathing CoderMaya's Avatar
    Join Date
    Feb 2008
    Location
    Atlit, Israel
    Posts
    470
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Great! RC3 looks pretty stable. After a few more days of testing it might come out as the first major release.
    Learn about the new Retro Framework
    Code PHP the way it was meant to be coded!

  4. #129
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hey Yam.

    Remember to check out the google discussion on it. I had posted a fix for record deleting which still hasn't been fixed in the libs.

    Also, the field names are still being converted to lower when trying to access a field, yet they aren't converted to lower when being stored. In other words, fields with capitals in can't be accessed with the unmodified code. I'd recommend just getting rid of the strtolower in the first place.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  5. #130
    Coding and Breathing CoderMaya's Avatar
    Join Date
    Feb 2008
    Location
    Atlit, Israel
    Posts
    470
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Fixed some stuff, thanks. Implemented your delete() method and also:

    $post->ID would now be set into $_values['id'] for sure. I do like it this way, because a lot of times you're unsure about the capitalization of the field, and DB's are CI in over 90% of cases, not to mention web DB cases. But it is working now, no matter how you capitalize the field!

    Final release up when the website I made goes up. Very soon, maybe today or tomorrow.
    Learn about the new Retro Framework
    Code PHP the way it was meant to be coded!

  6. #131
    Coding and Breathing CoderMaya's Avatar
    Join Date
    Feb 2008
    Location
    Atlit, Israel
    Posts
    470
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh and I also replied to all your topics there with solutions!
    Learn about the new Retro Framework
    Code PHP the way it was meant to be coded!

  7. #132
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Great

    One other thing that has bothered me with the RC3 is that db results are now returning as objects, whereas I much prefer them as the actual values. This comes into a problem when wanting to loop through a path until you get to a single root, with ID -1. Whilst you would normally use:
    PHP Code:
    $id 123;
    $path '';
    while(
    $id !== -1){
        
    $row single('topics', array('parent'=>$id));
        
    $path $row->name '/' $path;
        
    $id $row->id;

    now you'd have to use loose comparisons and use '-1' rather than -1 etc. Makes the loop just keep going otherwise.

    Also, the find_by_query() function now fails because it passes the result through escape - but now it's an object.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  8. #133
    Coding and Breathing CoderMaya's Avatar
    Join Date
    Feb 2008
    Location
    Atlit, Israel
    Posts
    470
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, you're right. Actual values it is now.
    Learn about the new Retro Framework
    Code PHP the way it was meant to be coded!

  9. #134
    Coding and Breathing CoderMaya's Avatar
    Join Date
    Feb 2008
    Location
    Atlit, Israel
    Posts
    470
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Good news guys:

    http://www.retro-framework.com/

    It also uses the new "mod rewrite off" option. (Since my host is giving me a headache about it, I was more motivated to include this option properly)
    Learn about the new Retro Framework
    Code PHP the way it was meant to be coded!

  10. #135
    Coding and Breathing CoderMaya's Avatar
    Join Date
    Feb 2008
    Location
    Atlit, Israel
    Posts
    470
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1.0.1 Released with a few fixes made during development of a decent application, which you can test here:

    http://www.retro-framework.com/blog/index.php/

    You can also get the source in google code

    http://code.google.com/p/retrophpmvc/downloads/list
    Learn about the new Retro Framework
    Code PHP the way it was meant to be coded!

  11. #136
    Coding and Breathing CoderMaya's Avatar
    Join Date
    Feb 2008
    Location
    Atlit, Israel
    Posts
    470
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Learn about the new Retro Framework
    Code PHP the way it was meant to be coded!

  12. #137
    Coding and Breathing CoderMaya's Avatar
    Join Date
    Feb 2008
    Location
    Atlit, Israel
    Posts
    470
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1.1 is on its way! Will probably be available in 2 weeks from now. You can read a bit more about it here http://retro-framework.com/forums/index.php?topic=10.0
    Learn about the new Retro Framework
    Code PHP the way it was meant to be coded!

  13. #138
    PHP/Rails Developer Czaries's Avatar
    Join Date
    May 2004
    Location
    Central USA
    Posts
    806
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I submitted a new issue - just a minor one!

  14. #139
    Coding and Breathing CoderMaya's Avatar
    Join Date
    Feb 2008
    Location
    Atlit, Israel
    Posts
    470
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Where?
    Learn about the new Retro Framework
    Code PHP the way it was meant to be coded!

  15. #140
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    http://code.google.com/p/retrophpmvc/issues/list



    Btw, I'm not sure I like the big abbreviations on variable names. $request->pb won't make any sense to someone new to the code, where as $request->postback will.

    Personally I can't stand functions and vars which aren't named descriptively
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  16. #141
    Coding and Breathing CoderMaya's Avatar
    Join Date
    Feb 2008
    Location
    Atlit, Israel
    Posts
    470
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Those are just shortcuts that are available, though, for people who do like them.

    The manual, tutorials, etc, will still feature the full way to do it.
    Learn about the new Retro Framework
    Code PHP the way it was meant to be coded!

  17. #142
    SitePoint Zealot tjyobazee's Avatar
    Join Date
    May 2006
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Will be looking forward to this framework

    btw, what about a milestone?

  18. #143
    SitePoint Addict
    Join Date
    Dec 2007
    Posts
    348
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how does your framework handle complex queries (such as with nested selects)?

    for example:

    Code MySQL:
    	SELECT topics.title, topics.id as topic_id, forums.description, maxdates.maxdate as last_date, forums.id, users.username, users.id as user_id, 
    			(SELECT COUNT( topics.id ) FROM topics WHERE forum_id = maxdates.forum_id) AS topics,
    			(SELECT COUNT( posts.id ) FROM posts, topics WHERE posts.topic_id = topics.id AND topics.forum_id = maxdates.forum_id) AS posts
    			FROM (
    				SELECT posts.topic_id, topics.forum_id, posts.date AS maxdate, 
    				posts.user_id, posts.id AS post_id
    				FROM posts
    				INNER JOIN topics ON topics.id = posts.topic_id
    				WHERE posts.date = (SELECT MAX( posts.date ) FROM posts WHERE posts.topic_id = topics.id )
    				GROUP BY topics.forum_id
    			) AS maxdates
    			INNER JOIN topics ON topics.id = maxdates.topic_id
    			RIGHT JOIN forums ON forums.id = maxdates.forum_id
    			LEFT JOIN users ON users.id = maxdates.user_id

    That's a query I use on a forums index page..

    Not trying to catch you guys out, I just can't see from the tutorials how I'd rig up a query like that in Retro..

  19. #144
    SitePoint Addict
    Join Date
    Dec 2007
    Posts
    348
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also how do you guys deal with getting data into your view layer (or your equivalent).

    Say you want to print a message on screen on every page showing whether the user is logged in or not. You'd need the code for this on every page... plus page-specific code

    This is actually one of the major issues I have with frameworks and website development in general. Displaying one page is easy enough but complex views always need more work.. so you could say that's what I find annoying about existing frameworks and is my suggestion to you

  20. #145
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    You can run queries without the assistance of find() etc, using find_by_query(). You can use the results just like you would with find.

    As for the viewing, data is sent like so:
    PHP Code:
    //In the controller:
    $data = array();
    $data['hello'] = 'World';
    render('yourpage', $data);
    //in views/yourpage.tpl:
    <p>
        <b>Hello: </b>
        <?=$hello;?>
    </p>
    Output:
    Code:
    <p>
        <b>Hello: </b>
        World
    </p>
    It doesn't matter whether short tags are on or off, because it's manually parsed with preg in PHP, to allow vars i.e. $data[$n] to be used as $n.

    So, with your example:
    PHP Code:
    <?php
    class UserController extends Controller{
        function 
    index($request){
            
    $data['loggedInMessage'] = array_key_exists('user'$_SESSION) ? $_SESSION['user']->getloggedInMessage() : User::$defaultLoggedInMessage;
            
    render("user"$data);
        }
    }
    PHP Code:
    <?php
    class User{
        static 
    $defaultLoggedInMessage "You aren't logged in dufus";
        private 
    $loggedIn false;
        function 
    login(){
            
    $loggedIn true;
        }
        function 
    getLoggedInMessage(){
            return 
    $loggedIn "You are logged in!" self::$defaultLoggedInMessage;
        }
    }
    Views/User.tpl:
    PHP Code:
    <h1>A Message</h1>
    <p>We have a message for you!</p>
    <p><?=$loggedInMessage;?></p>
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  21. #146
    SitePoint Addict
    Join Date
    Dec 2007
    Posts
    348
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, I read about the query thing earlier on, oooops.

    For the view, you're missing my point I think. Consider for example a page belonging to the forum part of a website, say the index page of the forums. This page obviously has to load and display a list of forums and number of posts, topics blah blah blah.

    This forums page is part of a larger page which may include other PHP-generated elements such as that loginbox.

    The thing is, you have described the usage of the UserController (which is exactly how I do it too) to retrieve the login info, yet you'd need a ForumController to retrieve and display the list of forums. So two controllers and potentially more on one page.. how do you handle that?

  22. #147
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Ok, I see what you mean.

    Well, a view can be inserted into another simple by:
    PHP Code:
    $firstpage['message'] = "hello world";
    $secondpage['message'] = _render('message'$firstpage);
    render('message2'$secondpage); 
    Now, echoing $message in message2.tpl will insert the output of the initial render of message.tpl.

    I see what you mean with the multiple controller idea though.

    Currently the way to acheive that would be to have a static method returning _render() of the template, and that can be saved to var in $data, for example:
    PHP Code:
    class User{
        static function 
    UserArea(){
            if(
    array_key_exists('user'$_SESSION)){
                
    $data['message'] = 'Logged in as '.session('user')->UserName;
                return 
    _render('userMessage'$data);
            }
            return 
    _render('loginForm');
        }

    PHP Code:
    $data['login'] = User::UserArea();
    render('somepage'$data); 
    PHP Code:
    <div id="user">
        <?=$login?>
    </div>
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  23. #148
    SitePoint Addict
    Join Date
    Dec 2007
    Posts
    348
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    okay, and you'd repeat the calling of that static method in every page you'd use it in?

    for example:

    Code PHP:
    $data['login'] = User::UserArea();
    $data['somepage'] = $this->getStuff();
    render('somepage', $data); 
     
    //or
     
    $data['login'] = User::UserArea();
    $data['some_specific_page'] = $this->getStuff();
    render('some_specific_page', $data); 
     
    //or
     
    $data['login'] = User::UserArea();
    $data['some_other_page'] = $this->getStuff();
    render('some_other_page', $data);

    edit: just to say, those three examples would be in three seperate controller methods..
    Last edited by old_iron; Oct 21, 2008 at 04:32.

  24. #149
    SitePoint Addict
    Join Date
    Feb 2007
    Posts
    251
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I haven't used this framework, but I'd imagine you could use something like this...

    PHP Code:
    class UserPage extends Controller {
        function 
    render($tpl$data) {
            
    $data['login'] = User::UserArea();
            
    render($tpl$data);
        }
    }

    class 
    SpecificUserPage extends UserPage {
        function 
    index($request) {
            
    $this->render('someOtherPage', array(
                
    'someVar' => $this->getSomeStuff()
            ));
        }


  25. #150
    SitePoint Addict
    Join Date
    Dec 2007
    Posts
    348
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cuberoot View Post
    I haven't used this framework, but I'd imagine you could use something like this...
    if that works then it'd be good that's how I do things in mine as well.. and there's an overall ApplicationPage which renders the whole page with specific components. but I don't keep extending the base class, I use composition. but both ways work


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •