archive-com.com » COM » S » SOLARPHP.COM

Total: 875

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".
  • Solar Framework for PHP 5
    First you need to map the alternate formats to the action methods Open SYSTEM source acme Acme App Blog php and add the following action format array to the setup method so it looks like the code below php protected function setup parent setup this model Solar Registry get model catalog allow xml as an action format when browsing the index action browsing to index xml will output to index xml php this action format array index array xml This tells Solar that if a user browses to http localhost blog index xml then it should look for a view named index xml php it should set the appropriate content type application xml and it should turn off the layout Try this by creating a new view script called index xml php in the SYSTEM source acme Acme App Blog View folder Add the following text to the newly created view script items php foreach this list as item item title php echo this escape item title title item php endforeach items Browse to http localhost blog index xml and you should see your page in xml format without a layout wrapping around it Depending on your browser you may

    Original URL path: http://solarphp.com/manual/views.formats (2016-02-13)
    Open archived version from archive


  • Solar Framework for PHP 5
    need a location for our new helper By default Solar expects to find view helpers in two places SYSTEM source acme Acme View Helper because our vendor name is Acme SYSTEM source solar Solar View Helper Additionally you can add locations to the class stack where Solar looks for helpers by editing the config file For example adding the following to SYSTEM config php config Solar View helper class array Acme App Helper would change the class stack to this Acme View Helper Acme App Helper Solar View Helper For simplicity sake we will use the default Acme View Helper Create a new folder called View in the SYSTEM source acme Acme folder cd SYSTEM source acme Acme mkdir View Create another folder called Helper in the SYSTEM source acme Acme View folder mkdir Helper Change to the Helper directory and create a file called Phone php cd Helper vim Phone php Add the following code the the Phone php file and save php View helper to take a 10 digit number and convert to class Acme View Helper Phone extends Solar View Helper Returns a formatted phone number param string int number Unformatted number return string The formatted number

    Original URL path: http://solarphp.com/manual/views.helpers (2016-02-13)
    Open archived version from archive

  • Solar Framework for PHP 5
    the body tag Handy for css and javascript body id php echo this controller page div id wrap div id header php include this template header php div div id nav php include this template nav php div div id main php Add the content from the application controller php echo this layout content div div id footer php include this template footer php div div body This layout script defines the structure of the page A cascading stylesheet will define the styles for each page element Each element of the page such as the header gets it s own sub layout script The output from an application controller s action is injected into the layout via the this layout content property 5 6 5 Create the header php and footer Sub Layouts Assuming you are still in the SYSTEM source acme Acme Controller Page Layout folder create the header php file vim header php Copy and paste the following text into the file and save div id branding h1 The Acme Blog h1 div This simple sub layout creates the header banner at the top Now create the footer php file in the same folder vim footer php Copy and paste the following text into the file and save div id footer p Copyright copy 2010 Acme p div This simple sub layout creates the footer at the bottom 5 6 6 Create the nav php and local php Sub Layouts Next we need some sort of navigation element Assuming you are still in the SYSTEM source acme Acme Controller Page Layout folder create the nav php file vim nav php Copy and paste the following text and save div id nav ul li php echo this action blog Blog Home li li php echo this action blog add ACTION ADD li li php echo this action blog drafts View Drafts li ul php allow for extra local navigation include this template local php div Notice the reference to the local php sub layout Adding this sub layout lets us optionally add extra navigation for each controller This will become clearer later on in this chapter Note The second list item in the navigation layout uses a locale key as the link text php echo this action blog add ACTION ADD Please see the API documentation on the Solar View Helper Action helper as well as chapter one for a brief introduction to locales In the same folder create the local php file vim local php Copy and paste the following text and save php placeholder for local navigation 5 6 7 Create a Stylesheet All the layout elements are now in place A quick view of the SYSTEM source acme Acme Controller Page Layout folder should show the following files Acme Controller Page Layout body php footer php head php header php local php nav php blog php Note Though not a requirement prefixing partials and nested views layouts with an underscore helps you easily identify them Browsing

    Original URL path: http://solarphp.com/manual/views.layouts (2016-02-13)
    Open archived version from archive

  • Solar Framework for PHP 5
    3 The Form Object 6 4 Form Elements 6 4 1 Element Names 6 5 View Presentation 6 6 View Decoration 6 7 Semi Automatic View Presentation 6 7 1 Fieldsets 6 7 2 Element Groups 6 8 Custom Record Elements 6 9 Locale Strings 6 9 1 Model Strings 6 9 2 Controller Strings 6 9 3 Invalid Strings Prev Up Next 5 6 Layouts Home 6 1 Introduction

    Original URL path: http://solarphp.com/manual/form (2016-02-13)
    Open archived version from archive

  • Solar Framework for PHP 5
    user for editing then validate the submitted data and save the record You can do this using the form objects that the record object generates for you In this chapter we will Use a controller to work with a model record and get a form object Discuss the structure of the form object Use view helpers to present the form object Prev Up Next Chapter 6 Models and Forms Home

    Original URL path: http://solarphp.com/manual/form.intro (2016-02-13)
    Open archived version from archive

  • Solar Framework for PHP 5
    POST blog in the request load into the record and save it data this request post blog this item load data this item save get form hints from the record this form this item newForm In narrative language the pattern is as follows Make sure we have enough information to fetch a record e g the primary key value Attempt the fetch the record and make sure we actually found it Check to see if the incoming request is the result of a submit button being pressed via the isProcess method The looks for a process key in the incoming request data and checks its value Incidentally this means you can use one action method to process the results of different kinds of submit buttons preview save cancel etc Retrieve data from the incoming request load it into the record and save the record Note that the record does its own filtering sanitize and validate If you like you can check the result of the save call it will be true if the save succeeded or false if it failed for any reason e g invalid data Finally regardless of the status of the record we ask it to generate

    Original URL path: http://solarphp.com/manual/form.controller (2016-02-13)
    Open archived version from archive

  • Solar Framework for PHP 5
    in the form input radio textarea select etc including its name type label value description attributes options and any invalidation messages Attributes for the form tag action method id class etc Overall feedback messages for the form as a whole and The current status of the form as a whole true means the form represents a process success false represents a process failure and null means that the form has

    Original URL path: http://solarphp.com/manual/form.object (2016-02-13)
    Open archived version from archive

  • Solar Framework for PHP 5
    in an select tag The newForm is able to pick a reasonable type for the element based on the kind of record property char and varchar columns get input types columns that use ValidateInList or ValidateInKeys filters get select types booleans get checkbox types and so on label A short label to be placed in a label tag associated with the element descr A longer piece of narrative text describing the element this could be used as a tooltip as help text or something similar value The current value of the element require A boolean indicating if the element is required to be non blank The newForm method knows that if a table column is NOT NULL it should set the element as required options An array of key value pairs where the key is the option value and the value is the option label text This is used for select and radio types so they know what options to present attribs An array of key value pairs where the key is an XHTML attribute name and the value is the attribute value invalid An array of messages regarding why the element value is invalid if at all 6 4 1 Element Names Each element corresponds to what its key will be in the POST array or if you are using the GET method the GET array generally not recommended but sometimes necessary The element names mimic an array format where the primary name matches the singular model name and the keys match the properties of the model record However the names are in fact a flat list of strings they just look like array keys For example given an Acme Model Blogs Record we will see these element names in the form object returned by the newForm method php

    Original URL path: http://solarphp.com/manual/form.elements (2016-02-13)
    Open archived version from archive



  •