Re: Prettier Static Pages Snippet

2006-05-30 Thread Langdon Stevenson

Thanks Larry.  It's on my to-do list :-)  This is a good excuse.

Regards,
Langdon

Larry E. Masters aka PhpNut wrote:
> @John,
> 
> Refactored:
> 
> if (!empty($path[$count - 1])) {
> $title = Inflector::humanize($path[$count - 1]);
> }
> 
> uses less code.
> 
> @Langdon,
> 
> I suggest you get the latest release also.
> 
> 
> -- 
> /**
> * @author Larry E. Masters
> * @var string $userName
> * @param string $realName
> * @returns string aka PhpNut
> * @access  public
> */

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Prettier Static Pages Snippet

2006-05-30 Thread John Zimmerman [gmail]

http://cakeforge.org/snippet/detail.php?type=snippet&id=68
Snippet updated.  I put Larry's name in the "changes" box.On 5/30/06, John Zimmerman <
[EMAIL PROTECTED]> wrote:Very nice.  Much better.I am updating the snippet.
I am also running the latest stable release listed on cakeforge.  v1.1.3.2967On 5/30/06, 
Larry E. Masters aka PhpNut <[EMAIL PROTECTED]> wrote:

@John,Refactored:    if (!empty($path[$count - 1])) {    $title = Inflector::humanize($path[$count - 1]);    }uses less code.@Langdon,I suggest you get the latest release also.
-- /*** @author Larry E. Masters* @var string $userName* @param string $realName* @returns string aka PhpNut* @access  public*/ 








--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Re: Prettier Static Pages Snippet

2006-05-30 Thread John Zimmerman [gmail]
I am using the 1.1 version.For the code you list below if you change it to the following you should be good to go.  I have not tested this in 1.0 though.Overall the modification in my snippet and the code below could use a little optimization to reduce line count and unnecessary operations, but I think my snippet make it easier for some to modify the 
1.1 code.     function display() {
 if (!func_num_args())
 { $this->redirect('/');
 } $path = func_get_args();
 if (!count($path)) {
 $this->redirect('/'); }
  /* BEGIN MODIFICATION 1 */
 $title = ucfirst($path[count($path)-1]);    $title_pieces = explode("_", $title);
 foreach($title_pieces as $key => $value) {
 $title_pieces[$key] = ucfirst($value); }
 $title = implode(" ", $title_pieces);
 /* END MODIFICATION 1 */
 $this->set('page', $path[0]); $this->set('subpage', empty($path[1])? null: $path[1]);
 /* BEGIN MODIFCATION 2 */
 $this->set('title', ucfirst($path[count($path)-1]));
 /* END MODIFICATION 2 */
 $this->render(join('/', $path)); }On 5/30/06, Langdon Stevenson <
[EMAIL PROTECTED]> wrote:> > Hi John> > Can you tell me which version of Cake this applies to?  The display> function in pages_controller.php of Cake version 1.0.0.2378 looks like
> the following, so I am unclear about how to apply the snippet.> > >  function display()>  {>  if (!func_num_args())>  {>  $this->redirect('/');
>  }>  $path = func_get_args();>  if (!count($path))>  {>  $this->redirect('/');>  }>  $this->set('page', $path[0]);
>  $this->set('subpage', empty($path[1])? null: $path[1]);>  $this->set('title', ucfirst($path[count($path)-1]));>  $this->render(join('/', $path));>  }
> > > Regards,> Langdon> > John Zimmerman [gmail] wrote:> > If anyone is interested I added a snippet to cakeforge that is a> > modifcation to the pages_controller.php that displays the thtml files
> > located in /app/views/pages.> >> > Basically it will make the titles look like> >> > 'Page Title'> >> > instead of> >> > 'Page_title'
> >> > Here is the link...> >> > http://cakeforge.org/snippet/detail.php?type=snippet&id=68> > <
http://cakeforge.org/snippet/detail.php?type=snippet&id=68>> > > > 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Re: Prettier Static Pages Snippet

2006-05-30 Thread Larry E. Masters aka PhpNut
@John,Refactored:    if (!empty($path[$count - 1])) {    $title = Inflector::humanize($path[$count - 1]);    }uses less code.@Langdon,I suggest you get the latest release also.
-- /*** @author Larry E. Masters* @var string $userName* @param string $realName* @returns string aka PhpNut* @access  public*/ 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Re: Prettier Static Pages Snippet

2006-05-30 Thread Langdon Stevenson

Hi John

Can you tell me which version of Cake this applies to?  The display 
function in pages_controller.php of Cake version 1.0.0.2378 looks like 
the following, so I am unclear about how to apply the snippet.


 function display()
 {
 if (!func_num_args())
 {
 $this->redirect('/');
 }
 $path = func_get_args();
 if (!count($path))
 {
 $this->redirect('/');
 }
 $this->set('page', $path[0]);
 $this->set('subpage', empty($path[1])? null: $path[1]);
 $this->set('title', ucfirst($path[count($path)-1]));
 $this->render(join('/', $path));
 }


Regards,
Langdon

John Zimmerman [gmail] wrote:
> If anyone is interested I added a snippet to cakeforge that is a 
> modifcation to the pages_controller.php that displays the thtml files 
> located in /app/views/pages.
> 
> Basically it will make the titles look like
> 
> 'Page Title'
> 
> instead of
> 
> 'Page_title'
> 
> Here is the link...
> 
> http://cakeforge.org/snippet/detail.php?type=snippet&id=68 
> 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Prettier Static Pages Snippet

2006-05-30 Thread John Zimmerman [gmail]
If anyone is interested I added a snippet to cakeforge that is a modifcation to the pages_controller.php that displays the thtml files located in /app/views/pages.Basically it will make the titles look like
'Page Title'instead of'Page_title'Here is the link...
http://cakeforge.org/snippet/detail.php?type=snippet&id=68

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---