SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 27 of 27
  1. #26
    Put your best practices away. The New Guy's Avatar
    Join Date
    Sep 2002
    Location
    Canada
    Posts
    2,087
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by mwmitchell
    Wow, scrap that. I think passing variables into the view is much better at this point. If something changes in this system, then I'd have to go thru all of the templates and remove $this->url() blah blah. I'm sticking with passing values into the view and letting the templates do $this->shop_url for now. This stuff is always so back and forth for me. Ugh!
    Yah, I like it that way much better. It feels like better seperation. Though, I guess it could be a little un-dry. But you could also step a mechanism to include it automatically.
    "A nerd who gets contacts
    and a trendy hair cut is still a nerd"

    - Stephen Colbert on Apple Users

  2. #27
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    > I'm sticking with passing values into the view and letting the templates do
    > $this->shop_url for now.

    I would proberly have to agree with you that this is the easiest option open to you, and is what I do,

    PHP Code:
    interface IPage extends IAcceptance {
            public function 
    __constructIDataspace $nodesIRequest $request );
            public function 
    render$template );
        }

    // take note of the import in the constructor...
    abstract class Page extends Dataspace implements IPage {
            protected 
    $request null;
            
            public function 
    __constructIDataspace $nodesIRequest $request ) {
                
    $this -> request $request;
                
    $this -> import$nodes );
            }
            
            public function 
    acceptIAcceptee $acceptee ) {
                return 
    $acceptee -> push$this );
            }
            
            public function 
    render$template ) {
                include_once( 
    $template );
            }
        } 
    I also have this for example,

    PHP Code:
    // ...
    public function push$acceptable ) {
    // this import is generally direct to a View, but not always...
    $acceptable -> import( new Parameters( array( 'key' => 'value' ... etc ... ) ) );
    }
    // ... 
    This all I need to do is use,

    Code:
    ...
    <head><?php echo $this -> get( 'head' ); ?></head>
    Or,

    Code:
    ...
    <?php foreach( $this -> get( 'posts' ) as $post ): ?>
    <p><?php echo $post -> get( 'id' ); ?> ... etc ...</p>
    <?php endforeach; ?>
    I use this approach as it opens up more flexibility for me


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
  •