Re: Html Helper: Better way to generate table ?

2015-05-09 Thread Aday Talavera
I've this methods in a helper:

Html->tag('table', null, array('class' => 
$table_class));
if (!empty($headers)) {
$content .= $this->Html->tag('thead', $this->Html->tableHeaders(
$headers, array('class' => $header_class)));
}
if (!empty($rows)) {
$content .= $this->Html->tag('tbody', $this->Html->tableCells(
$rows));
}
if (!empty($footer)) {
$content .= $this->Html->tag('tfoot', $this->Html->tableHeaders(
$footer, array('class' => $footer_class)));
}
$content .= $this->Html->tag('/table');
$content = $this->Html->div('table-responsive', $content);
return $content;
}
?>

And use them in views this way:

Paginator->sort('product_category_id', __('Categoría'));

// Table rows
$rows = array();
foreach ($products as $data) {
$row = array();
$row[] = $data['ProductCategory']['name'];
$row[] = $data['Product']['description'];
$row[] = $data['Product']['price'];
$rows[] = $row;
}

echo $this->Util->simple_table($headers, $rows);
?>

Feel free to use if you find them useful ;)

El jueves, 7 de mayo de 2015, 22:12:35 (UTC+1), samuel escribió:
>
> nice! Is bshelper part of cakephp?
>
> On Friday, May 1, 2015 at 9:54:43 PM UTC+1, Sylvain Lévesque wrote:
>>
>> > echo $this->Html->tag( 'table', null, array( 'class' => 'table 
>> table-hover table-condensed' ) );
>> echo $this->Html->tag( 'thead' );
>> echo $this->Html->tableHeaders( array( 'One', 'Two', 'Three', 'Four', 
>> 'Five', 'Six', 'Seven', 'Eight', 'Nine' ) );
>> echo $this->Html->useTag( 'tagend', array( 'thead' ) );
>> echo $this->Html->tag( 'tbody' );
>> echo $this->Html->tableCells( array(
>> array( 1,2,3,4,5,6,7,8,9 ),
>> array( 1,2,3,4,5,6,7,8,9 ),
>> array( 1,2,3,4,5,6,7,8,9 ),
>> array( 1,2,3,4,5,6,7,8,9 ),
>> array( 1,2,3,4,5,6,7,8,9 ),
>> array( 1,2,3,4,5,6,7,8,9 ),
>> ) );
>> echo $this->Html->useTag( 'tagend', array( 'tbody' ) );
>> echo $this->Html->useTag( 'tagend', array( 'table' ) );
>> ?>
>>
>> OR
>>
>> 
>> 
>> BsHtml->tableHeaders( array( 'One', 'Two', 'Three', 
>> 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine' ) ); ?>
>> 
>> 
>> BsHtml->tableCells( array(
>> array( 1,2,3,4,5,6,7,8,9 ),
>> array( 1,2,3,4,5,6,7,8,9 ),
>> array( 1,2,3,4,5,6,7,8,9 ),
>> array( 1,2,3,4,5,6,7,8,9 ),
>> array( 1,2,3,4,5,6,7,8,9 ),
>> array( 1,2,3,4,5,6,7,8,9 ),
>> ) ); ?>
>> 
>> 
>>
>>
>> It should be a better way to generate table without building a custom 
>> helper. Isn't it ?
>>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Html Helper: Better way to generate table ?

2015-05-07 Thread samuel
nice! Is bshelper part of cakephp?

On Friday, May 1, 2015 at 9:54:43 PM UTC+1, Sylvain Lévesque wrote:
>
>  echo $this->Html->tag( 'table', null, array( 'class' => 'table 
> table-hover table-condensed' ) );
> echo $this->Html->tag( 'thead' );
> echo $this->Html->tableHeaders( array( 'One', 'Two', 'Three', 'Four', 
> 'Five', 'Six', 'Seven', 'Eight', 'Nine' ) );
> echo $this->Html->useTag( 'tagend', array( 'thead' ) );
> echo $this->Html->tag( 'tbody' );
> echo $this->Html->tableCells( array(
> array( 1,2,3,4,5,6,7,8,9 ),
> array( 1,2,3,4,5,6,7,8,9 ),
> array( 1,2,3,4,5,6,7,8,9 ),
> array( 1,2,3,4,5,6,7,8,9 ),
> array( 1,2,3,4,5,6,7,8,9 ),
> array( 1,2,3,4,5,6,7,8,9 ),
> ) );
> echo $this->Html->useTag( 'tagend', array( 'tbody' ) );
> echo $this->Html->useTag( 'tagend', array( 'table' ) );
> ?>
>
> OR
>
> 
> 
> BsHtml->tableHeaders( array( 'One', 'Two', 'Three', 
> 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine' ) ); ?>
> 
> 
> BsHtml->tableCells( array(
> array( 1,2,3,4,5,6,7,8,9 ),
> array( 1,2,3,4,5,6,7,8,9 ),
> array( 1,2,3,4,5,6,7,8,9 ),
> array( 1,2,3,4,5,6,7,8,9 ),
> array( 1,2,3,4,5,6,7,8,9 ),
> array( 1,2,3,4,5,6,7,8,9 ),
> ) ); ?>
> 
> 
>
>
> It should be a better way to generate table without building a custom 
> helper. Isn't it ?
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Html helper generate invalid code: No space between attributes!

2013-05-15 Thread Salines
*Sorry, html helpers working correctly.*

bugs make twitter bootstrap helper.

Dana četvrtak, 16. svibnja 2013. 01:43:11 UTC+2, korisnik Salines napisao 
je:
>
> *Hello *
> *
> *
> I noticed that htmlhelper generated errors and creates not valid html code.
>
>  Html -> charset(); ?>
>
> generate:  with missing quote
>
> // 
>
> other errors generated by html helper 
> http://validator.w3.org/check?uri=http%3A%2F%2Ffarm.ba%2F&charset=%28detect+automatically%29&doctype=Inline&group=0&st=1&user-agent=W3C_Validator%2F1.3+http%3A%2F%2Fvalidator.w3.org%2Fservices
>
> i used cakephp 2.3.5
> *
> *
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




RE: html helper - image outside of webroot/img dir

2013-04-01 Thread Advantage+
No problem. Hope it helped. No expert but seems pretty straight forward so
glad I could help in any way.

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of Robert Gravel
Sent: Monday, April 01, 2013 11:08 PM
To: cake-php@googlegroups.com
Subject: Re: html helper - image outside of webroot/img dir

 

Thanks. Got it

On Monday, April 1, 2013 9:27:12 PM UTC-4, advantage+ wrote:

Check CKEditor config settings for the folder to save files to and point it
to img/uploads or what not and refer as $this->Html->image('uploads/' .
$file) something along those lines. But if it's a CK image from the editor
package itself  just reference it as the correct path/filename

 

From: cake...@googlegroups.com 
[mailto:cake...@googlegroups.com  ] On Behalf Of Robert Gravel
Sent: Monday, April 01, 2013 10:42 PM
To: cake...@googlegroups.com  
Subject: html helper - image outside of webroot/img dir

 

Hi,
I need to display an image outside the webroot/img  dir for cake 1.3.
Specifically I have to link to an image in the ckeditor which is at
webroot/js/ckeditor...

When I use $this->Html->image() it gives me a reference at webroot/img by
default. Is there a solution that is portable between localhost   and server

Thanks
Rob G

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
--- 
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to cake-php+u...@googlegroups.com  .
To post to this group, send email to cake...@googlegroups.com 
.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
--- 
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: html helper - image outside of webroot/img dir

2013-04-01 Thread Robert Gravel
Thanks. Got it

On Monday, April 1, 2013 9:27:12 PM UTC-4, advantage+ wrote:
>
> Check CKEditor config settings for the folder to save files to and point 
> it to img/uploads or what not and refer as $this->Html->image('uploads/' . 
> $file) something along those lines. But if it’s a CK image from the editor 
> package itself  just reference it as the correct path/filename
>
>  
>
> *From:* cake...@googlegroups.com  [mailto:
> cake...@googlegroups.com ] *On Behalf Of *Robert Gravel
> *Sent:* Monday, April 01, 2013 10:42 PM
> *To:* cake...@googlegroups.com 
> *Subject:* html helper - image outside of webroot/img dir
>
>  
>
> Hi,
> I need to display an image outside the webroot/img  dir for cake 1.3. 
> Specifically I have to link to an image in the ckeditor which is at 
> webroot/js/ckeditor...
>
> When I use $this->Html->image() it gives me a reference at webroot/img by 
> default. Is there a solution that is portable between localhost   and server
>
> Thanks
> Rob G
>
> -- 
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>  
> --- 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to cake-php+u...@googlegroups.com .
> To post to this group, send email to cake...@googlegroups.com
> .
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




RE: html helper - image outside of webroot/img dir

2013-04-01 Thread Advantage+
Check CKEditor config settings for the folder to save files to and point it
to img/uploads or what not and refer as $this->Html->image('uploads/' .
$file) something along those lines. But if it's a CK image from the editor
package itself  just reference it as the correct path/filename

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of Robert Gravel
Sent: Monday, April 01, 2013 10:42 PM
To: cake-php@googlegroups.com
Subject: html helper - image outside of webroot/img dir

 

Hi,
I need to display an image outside the webroot/img  dir for cake 1.3.
Specifically I have to link to an image in the ckeditor which is at
webroot/js/ckeditor...

When I use $this->Html->image() it gives me a reference at webroot/img by
default. Is there a solution that is portable between localhost   and server

Thanks
Rob G

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
--- 
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Html helper - stop adding prefix unless explicitly specified

2011-10-05 Thread Zaky Katalan-Ezra
I have 3 roles in my app.
To Avoid adding the prefix arrays to each url, I am using this helper
function.
View code to create musician prefix url:
echo $this->Html->link('Dashboard',
$this->RoleLink->linkRole(array('controller'=>'users','action'=>'dashboard'),array('musician')));

Helper function:
function linkRole($default=array(),$whitelist=array()) {
return array_merge($default,
array('prefix'=>array('admin','label','musician'),'admin'=>
in_array('admin', $whitelist),'label'=>in_array('label',
$whitelist),'musician'=>in_array('musician', $whitelist)));
}

I hope it will help someone or even better if someone will give me a simpler
way to do it.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Html helper - stop adding prefix unless explicitly specified

2011-10-05 Thread nowotny
On 5 Paź, 03:31, rchavik  wrote:
> You could create a custom helper inheriting HtmlHelper, then use the 
> joeb'sAnalogue pluginto masquerade 
> your helper as core HtmlHelper. This way, you don't have to
> modify your view files

Thanks... that got me thinking so I dug into the whole thing and I
found out the solution... Long story short - I overrode Router's url()
method and set it to explicitly set 'admin'=>false for urls in
prefixed routes...

Here's the code that goes into app_helper.php:

class AppHelper extends Helper {

  function url($url = null, $full = false) {
 if(isset($this->params['prefix'])){
$prefix = $this->params['prefix'];

if($this->params[$prefix] && (!isset($url[$prefix]) || !
$url[$prefix])){
   $url[$prefix] = false;
}
 }
 return parent::url($url, $full);
  }
}

So far it works like a charm... we'll see how it goes...

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Html helper - stop adding prefix unless explicitly specified

2011-10-05 Thread Saransh Sharma
hey send me more and big clear pics
On Wednesday, October 5, 2011, rchavik wrote:

> You could create a custom helper inheriting HtmlHelper, then use the 
> joeb'sAnalogue pluginto masquerade 
> your helper as core HtmlHelper. This way, you don't have to
> modify your view files
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com  'cake-php%2bunsubscr...@googlegroups.com');> For more options, visit this
> group at http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Html helper - stop adding prefix unless explicitly specified

2011-10-04 Thread rchavik
You could create a custom helper inheriting HtmlHelper, then use the 
joeb'sAnalogue pluginto masquerade your 
helper as core HtmlHelper. This way, you don't have to 
modify your view files

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Html helper - stop adding prefix unless explicitly specified

2011-10-04 Thread nowotny
On 28 Wrz, 19:44, euromark  wrote:
> i use a custom app helper method i called defaultLink() which resets
> all prefixes unless specified.
> although thats maybe not exactly what you have in mind
> but you could make sth similar with your own default values
>
> either way - called via
> $this->Html->defaultLink();
> in any view as always

Yeah... the idea was for me not to go into hundreds of view files and
editing the code manually...

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Html helper - stop adding prefix unless explicitly specified

2011-09-28 Thread euromark
i use a custom app helper method i called defaultLink() which resets
all prefixes unless specified.
although thats maybe not exactly what you have in mind
but you could make sth similar with your own default values

either way - called via
$this->Html->defaultLink();
in any view as always



On 28 Sep., 15:53, nowotny  wrote:
> Hello.
>
> Let's say you have a menu in the layout that should be constant
> throughout the whole site with the following links:
> $this->Html->link('Posts',array('controller'=>'posts','action'=>'index'));
> $this->Html-
> >link('Users',array('controller'=>'users','action'=>'index',
>
> 'admin'=>true));
>
> If you're in e.g.www.domain.com/pages/indexthose two links point 
> to:www.domain.com/postswww.domain.com/admin/users
>
> And that's OK. But when you're in a prefixed route, 
> e.g.www.domain.com/admin/tags/index, all the links are 
> prefixed:www.domain.com/admin/posts(<- wrong)www.domain.com/admin/users
>
> I know I could add 'admin'=>false to all links that should not be
> prefixed but that's not really a feasible solution.
>
> So here comes my question: is there a way for Html helper not to add
> prefixes to links in prefixed routes unless when I explicitly set it
> to do so with 'admin'=>true?
>
> I think it should be possible by defining a route but I was not
> successful in setting one up correctly.
>
> BTW: I'm using CakePHP 1.3.12

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Html Helper Tables :: Pure Curiosity

2011-07-15 Thread Miles J
Its to generate rows using a helper, not really meant for generation
within the view.

On Jul 15, 7:28 am, DragonFlyEye  wrote:
> Does anybody know a reason that the Html Helper contains a method to output
> table cells and headers, but not a method to output tables? Like, at least
> tableStart and tableEnd?
>
> It just looks sloppy to echo '' when everything else is done via the
> helper.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: HTML helper (Meta Icon) duplicating unnecessarily?

2011-05-05 Thread Ross
That makes sense! Thank you.

On May 5, 9:28 am, Ryan Schmidt  wrote:
> On May 4, 2011, at 15:47, Ross wrote:
>
>
>
>
>
>
>
>
>
> > I just got started with CakePHP, and have the following in  my layout,
> > between the  tags's as you'd expect:
>
> > Html->meta('icon') . "\t\n";   ?>
>
> > The output, however is:
>
> >  > rel="icon" />
> >  > rel="shortcut icon" /
>
> > Now it's not the end of the world, and I know I can do it manually,
> > but could someone please shed some light as to why this is repeated
> > twice, with only "shortcut" added? It doesn't make a lot of sense to
> > me.
>
> Some browsers use link rel=icon. Some browsers use link rel=shortcut icon. To 
> support all browsers, you must add both lines. That's why CakePHP adds both 
> lines.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: HTML helper (Meta Icon) duplicating unnecessarily?

2011-05-05 Thread Ryan Schmidt

On May 4, 2011, at 15:47, Ross wrote:

> I just got started with CakePHP, and have the following in  my layout,
> between the  tags's as you'd expect:
> 
> Html->meta('icon') . "\t\n";   ?>
> 
> The output, however is:
> 
>  rel="icon" />
>  rel="shortcut icon" /
> 
> Now it's not the end of the world, and I know I can do it manually,
> but could someone please shed some light as to why this is repeated
> twice, with only "shortcut" added? It doesn't make a lot of sense to
> me.

Some browsers use link rel=icon. Some browsers use link rel=shortcut icon. To 
support all browsers, you must add both lines. That's why CakePHP adds both 
lines.



-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: HTML helper (Meta Icon) duplicating unnecessarily?

2011-05-05 Thread euromark
as far as i know thats in order to address all browsers (because some
stupid ones - i won't name any^^ - behave differently as the rest)

On 4 Mai, 22:47, Ross  wrote:
> Hi
>
> I just got started with CakePHP, and have the following in  my layout,
> between the  tags's as you'd expect:
>
> Html->meta('icon') . "\t\n";   ?>
>
> The output, however is:
>
>  rel="icon" />
>  rel="shortcut icon" /
>
> Now it's not the end of the world, and I know I can do it manually,
> but could someone please shed some light as to why this is repeated
> twice, with only "shortcut" added? It doesn't make a lot of sense to
> me.
>
> I have searched, but there didn't seem to be anything too recent that
> mentions this behavior. I am using a fresh copy of CakePHP 1.3.8.
>
> Regards

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: HTML helper in function?

2009-08-12 Thread Josh

Ahhh... passing a handle as an argument. It seems so obvious now.
Thanks

I have actually already moved things to a helper, which makes more
sense anyway. The helper I have will suit my needs fine this time
around.  It will be easy to wrap tags around the menu elements when I
get around to the CSS. Next time I will use the TreeHelper... I'm sure
it will save time.

Thanks again.


On Aug 12, 12:46 pm, brian  wrote:
> Pass a handle to the helper to your function:
>
> outputMenu($html, $linkTree, $level);
>
> function outputMenu(&$html, $array, $level) {
>
> Even better, have a look at Andy Dawson's TreeHelper. I think it's
> precisely what you need for this.
>
> http://bakery.cakephp.org/articles/view/tree-helper-1
>
> Let me know if you need help. I've implemented it for an
> ACL-controlled menu and it works great.
>
>
>
> On Tue, Aug 11, 2009 at 7:02 PM, Josh wrote:
>
> > Hi,
>
> > I have the contents of a tree menu stored in a multi-dimensional
> > array. The number of dimensions is not fixed, so to turn the array
> > into a menu in the View file, I have set up a recurring function. This
> > works fine except that I can't call the $html->link() from the
> > function.
>
> > Fatal error: Call to a member function link() on a non-object in...
>
> > Any ideas? Is there a way to make the link() function global as you do
> > a variable? There are some obvious work-arounds such as writing the
> > anchor tag without the html helper, or turning the link array into a
> > simpler two dimensional array where I can then iterate the link()
> > function. However, I am wonder how I might specifically address the
> > question of making the html->link() function available to a function
> > within a view file.
>
> > I have a feeling this is either going to be a simple declaration or
> > not worth the trouble. Thanks in advance.
>
> > Here is my code:
>
> >    //array of links
> >    key: link title
> >    value: link location or sub-array
> >    $linkTree = array(
> >        'User Management' => array(
> >            'Permissions' => array(
> >                'Set Permissions' => '/tools/setPermissions',
> >                'Update ACOS' => '/tools/updateacl',
> >                'View/Edit Groups' => '/admin/groups'
> >            ),
> >            'User Settings' => '/tools/userSettings',
> >            'Users' => array(
> >                'List' => '/admin/users',
> >                'Add User' => '/admin/users/add'
> >            )
> >        )
> >    );
>
> >    //output menu function
> >    function outputMenu ($array, $level) {
> >        global $levelMarker;
>
> >        foreach ($array as $key => $value) {
> >            if (is_array($value)) {
> >                echo $level . $key;
> >                echo '';
> >                outputMenu($value, $level . $levelMarker);
> >            } else {
> >                echo $html->link("$level$key", $value);
> >                echo '';
> >            }
> >        }
> >        echo "";
> >    }
>
> >    //output menu settings
> >    $levelMarker = '-';
> >    $level = '';
> >    $linkTreeSimple = array();
>
> >    //output menu
> >    outputMenu($linkTree, $level);
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HTML helper in function?

2009-08-12 Thread brian

Pass a handle to the helper to your function:

outputMenu($html, $linkTree, $level);

function outputMenu(&$html, $array, $level) {

Even better, have a look at Andy Dawson's TreeHelper. I think it's
precisely what you need for this.

http://bakery.cakephp.org/articles/view/tree-helper-1

Let me know if you need help. I've implemented it for an
ACL-controlled menu and it works great.

On Tue, Aug 11, 2009 at 7:02 PM, Josh wrote:
>
> Hi,
>
> I have the contents of a tree menu stored in a multi-dimensional
> array. The number of dimensions is not fixed, so to turn the array
> into a menu in the View file, I have set up a recurring function. This
> works fine except that I can't call the $html->link() from the
> function.
>
> Fatal error: Call to a member function link() on a non-object in...
>
> Any ideas? Is there a way to make the link() function global as you do
> a variable? There are some obvious work-arounds such as writing the
> anchor tag without the html helper, or turning the link array into a
> simpler two dimensional array where I can then iterate the link()
> function. However, I am wonder how I might specifically address the
> question of making the html->link() function available to a function
> within a view file.
>
> I have a feeling this is either going to be a simple declaration or
> not worth the trouble. Thanks in advance.
>
> Here is my code:
>
>
>    //array of links
>    key: link title
>    value: link location or sub-array
>    $linkTree = array(
>        'User Management' => array(
>            'Permissions' => array(
>                'Set Permissions' => '/tools/setPermissions',
>                'Update ACOS' => '/tools/updateacl',
>                'View/Edit Groups' => '/admin/groups'
>            ),
>            'User Settings' => '/tools/userSettings',
>            'Users' => array(
>                'List' => '/admin/users',
>                'Add User' => '/admin/users/add'
>            )
>        )
>    );
>
>    //output menu function
>    function outputMenu ($array, $level) {
>        global $levelMarker;
>
>        foreach ($array as $key => $value) {
>            if (is_array($value)) {
>                echo $level . $key;
>                echo '';
>                outputMenu($value, $level . $levelMarker);
>            } else {
>                echo $html->link("$level$key", $value);
>                echo '';
>            }
>        }
>        echo "";
>    }
>
>    //output menu settings
>    $levelMarker = '-';
>    $level = '';
>    $linkTreeSimple = array();
>
>    //output menu
>    outputMenu($linkTree, $level);
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HTML helper in function?

2009-08-12 Thread Josh

@James - The code I have up there should produce the error. Throw the
$this-> object reference in front of the html->link() to get the
reference to a non-object error

@Martin - Are you sure you can do that with an object? I think Global
can only be applied to variables, no? I'll try it out of curiosity.

@Grigri - Ultimately, a helper makes most sense, I agree. I'll be able
to extend it with the Html class and reference the whole object from
within the function.

Thanks for all the help.

On Aug 12, 7:51 am, grigri  wrote:
> Hi Josh,
>
> With that sort of code, you'd be better off putting it in your own
> helper. That helper can load its own helpers, so doing links wouldn't
> be a problem.
>
> This 
> thread:http://groups.google.com/group/cake-php/browse_thread/thread/f3a8243e...
> deals with this approach, but for radio boxes not links; the principle
> is the same though.
>
> Cheers
> grigri
>
> On Aug 12, 12:02 am, Josh  wrote:
>
>
>
> > Hi,
>
> > I have the contents of a tree menu stored in a multi-dimensional
> > array. The number of dimensions is not fixed, so to turn the array
> > into a menu in the View file, I have set up a recurring function. This
> > works fine except that I can't call the $html->link() from the
> > function.
>
> > Fatal error: Call to a member function link() on a non-object in...
>
> > Any ideas? Is there a way to make the link() function global as you do
> > a variable? There are some obvious work-arounds such as writing the
> > anchor tag without the html helper, or turning the link array into a
> > simpler two dimensional array where I can then iterate the link()
> > function. However, I am wonder how I might specifically address the
> > question of making the html->link() function available to a function
> > within a view file.
>
> > I have a feeling this is either going to be a simple declaration or
> > not worth the trouble. Thanks in advance.
>
> > Here is my code:
>
> >     //array of links
> >     key: link title
> >     value: link location or sub-array
> >     $linkTree = array(
> >         'User Management' => array(
> >             'Permissions' => array(
> >                 'Set Permissions' => '/tools/setPermissions',
> >                 'Update ACOS' => '/tools/updateacl',
> >                 'View/Edit Groups' => '/admin/groups'
> >             ),
> >             'User Settings' => '/tools/userSettings',
> >             'Users' => array(
> >                 'List' => '/admin/users',
> >                 'Add User' => '/admin/users/add'
> >             )
> >         )
> >     );
>
> >     //output menu function
> >     function outputMenu ($array, $level) {
> >         global $levelMarker;
>
> >         foreach ($array as $key => $value) {
> >             if (is_array($value)) {
> >                 echo $level . $key;
> >                 echo '';
> >                 outputMenu($value, $level . $levelMarker);
> >             } else {
> >                 echo $html->link("$level$key", $value);
> >                 echo '';
> >             }
> >         }
> >         echo "";
> >     }
>
> >     //output menu settings
> >     $levelMarker = '-';
> >     $level = '';
> >     $linkTreeSimple = array();
>
> >     //output menu
> >     outputMenu($linkTree, $level);
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HTML helper in function?

2009-08-12 Thread grigri

Hi Josh,

With that sort of code, you'd be better off putting it in your own
helper. That helper can load its own helpers, so doing links wouldn't
be a problem.

This thread: 
http://groups.google.com/group/cake-php/browse_thread/thread/f3a8243e2226c696
deals with this approach, but for radio boxes not links; the principle
is the same though.

Cheers
grigri

On Aug 12, 12:02 am, Josh  wrote:
> Hi,
>
> I have the contents of a tree menu stored in a multi-dimensional
> array. The number of dimensions is not fixed, so to turn the array
> into a menu in the View file, I have set up a recurring function. This
> works fine except that I can't call the $html->link() from the
> function.
>
> Fatal error: Call to a member function link() on a non-object in...
>
> Any ideas? Is there a way to make the link() function global as you do
> a variable? There are some obvious work-arounds such as writing the
> anchor tag without the html helper, or turning the link array into a
> simpler two dimensional array where I can then iterate the link()
> function. However, I am wonder how I might specifically address the
> question of making the html->link() function available to a function
> within a view file.
>
> I have a feeling this is either going to be a simple declaration or
> not worth the trouble. Thanks in advance.
>
> Here is my code:
>
>     //array of links
>     key: link title
>     value: link location or sub-array
>     $linkTree = array(
>         'User Management' => array(
>             'Permissions' => array(
>                 'Set Permissions' => '/tools/setPermissions',
>                 'Update ACOS' => '/tools/updateacl',
>                 'View/Edit Groups' => '/admin/groups'
>             ),
>             'User Settings' => '/tools/userSettings',
>             'Users' => array(
>                 'List' => '/admin/users',
>                 'Add User' => '/admin/users/add'
>             )
>         )
>     );
>
>     //output menu function
>     function outputMenu ($array, $level) {
>         global $levelMarker;
>
>         foreach ($array as $key => $value) {
>             if (is_array($value)) {
>                 echo $level . $key;
>                 echo '';
>                 outputMenu($value, $level . $levelMarker);
>             } else {
>                 echo $html->link("$level$key", $value);
>                 echo '';
>             }
>         }
>         echo "";
>     }
>
>     //output menu settings
>     $levelMarker = '-';
>     $level = '';
>     $linkTreeSimple = array();
>
>     //output menu
>     outputMenu($linkTree, $level);
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HTML helper in function?

2009-08-12 Thread Martin Westin

I don't know how you do it James. I just did a quick test in a view
and defining a function inline in the view will not provide that
function with access to the local variables outside the function
($html, $form...)

One ugly way of making it work is to make a global reference to the
html helper (if passing it as an argument is not to your liking).

global $htmlHelp;
$htmlHelp = $html;
function testing() {
global $htmlHelp;
debug( $htmlHelp->url('/') );
}
testing();

This is not a fix but a very ugly workaround.
Another possible workaround is to, instead of a recursive function,
try a recursive element.



On Aug 12, 7:13 am, JamesF  wrote:
> if you have time would you mind posting a test case or example code? i
> would love to see some more of the code in context just so I can
> improve my understanding of the issue.
>
> please let us know what works in the end for you it might help someone
> in the future
>
> On Aug 12, 1:09 am, Josh  wrote:
>
>
>
> > It works fine outside of the function. I've run into this before;
> > helper functions not working within View functions. Are you sure
> > you've had that work in the past?
>
> > I think the issue is that you normally (in models, controllers,
> > components...) need to reference the object where the function is
> > located with $this-> in order to access functions accessible to the
> > whole object. However, View files don't typically have their own
> > classes and objects (excluding helpers) since most of the logic is
> > handled elsewhere in the app.  Therefore, you get either an unknown
> > method error or non-object error.
>
> > I think I will throw this all in an array -> menu helper with the Html
> > helper. That way I'll be able to reference the object with the link()
> > function.
>
> > Thanks for your help.
>
> > On Aug 11, 11:15 pm, JamesF  wrote:
>
> > > hmm im not sure if this will work but you could try in your element:
>
> > > App:import('Helper', Html');
>
> > > $html = new html();
>
> > > does html helper work in other parts of your element outside the
> > > function? i usually have no problems at all using $html->link() within
> > > an element function.
>
> > > On Aug 11, 10:47 pm, Josh  wrote:
>
> > > > The helpers are set and work fine. However, $html->link() does not
> > > > work when called within a function in the view.
>
> > > > As for where the logic is written: this is an element that appears in
> > > > all admin tools throughout the site. requestAction() would allow me to
> > > > put some of the logic in the controller, however since this is an
> > > > array used only for constructing a menu, I don't really see any
> > > > advantage to that.
>
> > > > On Aug 11, 7:15 pm, JamesF  wrote:
>
> > > > > if your controller is set up with var $helpers = array('html') ; you
> > > > > should be fine..that error is just telling you that cake can't find
> > > > > HtmlHelper...is there a reason you are executing that logic in your
> > > > > view and not the controller?
>
> > > > > On Aug 11, 7:02 pm, Josh  wrote:
>
> > > > > > Hi,
>
> > > > > > I have the contents of a tree menu stored in a multi-dimensional
> > > > > > array. The number of dimensions is not fixed, so to turn the array
> > > > > > into a menu in the View file, I have set up a recurring function. 
> > > > > > This
> > > > > > works fine except that I can't call the $html->link() from the
> > > > > > function.
>
> > > > > > Fatal error: Call to a member function link() on a non-object in...
>
> > > > > > Any ideas? Is there a way to make the link() function global as you 
> > > > > > do
> > > > > > a variable? There are some obvious work-arounds such as writing the
> > > > > > anchor tag without the html helper, or turning the link array into a
> > > > > > simpler two dimensional array where I can then iterate the link()
> > > > > > function. However, I am wonder how I might specifically address the
> > > > > > question of making the html->link() function available to a function
> > > > > > within a view file.
>
> > > > > > I have a feeling this is either going to be a simple declaration or
> > > > > > not worth the trouble. Thanks in advance.
>
> > > > > > Here is my code:
>
> > > > > >     //array of links
> > > > > >     key: link title
> > > > > >     value: link location or sub-array
> > > > > >     $linkTree = array(
> > > > > >         'User Management' => array(
> > > > > >             'Permissions' => array(
> > > > > >                 'Set Permissions' => '/tools/setPermissions',
> > > > > >                 'Update ACOS' => '/tools/updateacl',
> > > > > >                 'View/Edit Groups' => '/admin/groups'
> > > > > >             ),
> > > > > >             'User Settings' => '/tools/userSettings',
> > > > > >             'Users' => array(
> > > > > >                 'List' => '/admin/users',
> > > > > >                 'Add User' => '/admin/users/add'
> > > > > >             )
> > > > > >         )
> > > > > >     );
>
> > > > > >     //output

Re: HTML helper in function?

2009-08-11 Thread Josh

It works fine outside of the function. I've run into this before;
helper functions not working within View functions. Are you sure
you've had that work in the past?

I think the issue is that you normally (in models, controllers,
components...) need to reference the object where the function is
located with $this-> in order to access functions accessible to the
whole object. However, View files don't typically have their own
classes and objects (excluding helpers) since most of the logic is
handled elsewhere in the app.  Therefore, you get either an unknown
method error or non-object error.

I think I will throw this all in an array -> menu helper with the Html
helper. That way I'll be able to reference the object with the link()
function.

Thanks for your help.


On Aug 11, 11:15 pm, JamesF  wrote:
> hmm im not sure if this will work but you could try in your element:
>
> App:import('Helper', Html');
>
> $html = new html();
>
> does html helper work in other parts of your element outside the
> function? i usually have no problems at all using $html->link() within
> an element function.
>
> On Aug 11, 10:47 pm, Josh  wrote:
>
>
>
> > The helpers are set and work fine. However, $html->link() does not
> > work when called within a function in the view.
>
> > As for where the logic is written: this is an element that appears in
> > all admin tools throughout the site. requestAction() would allow me to
> > put some of the logic in the controller, however since this is an
> > array used only for constructing a menu, I don't really see any
> > advantage to that.
>
> > On Aug 11, 7:15 pm, JamesF  wrote:
>
> > > if your controller is set up with var $helpers = array('html') ; you
> > > should be fine..that error is just telling you that cake can't find
> > > HtmlHelper...is there a reason you are executing that logic in your
> > > view and not the controller?
>
> > > On Aug 11, 7:02 pm, Josh  wrote:
>
> > > > Hi,
>
> > > > I have the contents of a tree menu stored in a multi-dimensional
> > > > array. The number of dimensions is not fixed, so to turn the array
> > > > into a menu in the View file, I have set up a recurring function. This
> > > > works fine except that I can't call the $html->link() from the
> > > > function.
>
> > > > Fatal error: Call to a member function link() on a non-object in...
>
> > > > Any ideas? Is there a way to make the link() function global as you do
> > > > a variable? There are some obvious work-arounds such as writing the
> > > > anchor tag without the html helper, or turning the link array into a
> > > > simpler two dimensional array where I can then iterate the link()
> > > > function. However, I am wonder how I might specifically address the
> > > > question of making the html->link() function available to a function
> > > > within a view file.
>
> > > > I have a feeling this is either going to be a simple declaration or
> > > > not worth the trouble. Thanks in advance.
>
> > > > Here is my code:
>
> > > >     //array of links
> > > >     key: link title
> > > >     value: link location or sub-array
> > > >     $linkTree = array(
> > > >         'User Management' => array(
> > > >             'Permissions' => array(
> > > >                 'Set Permissions' => '/tools/setPermissions',
> > > >                 'Update ACOS' => '/tools/updateacl',
> > > >                 'View/Edit Groups' => '/admin/groups'
> > > >             ),
> > > >             'User Settings' => '/tools/userSettings',
> > > >             'Users' => array(
> > > >                 'List' => '/admin/users',
> > > >                 'Add User' => '/admin/users/add'
> > > >             )
> > > >         )
> > > >     );
>
> > > >     //output menu function
> > > >     function outputMenu ($array, $level) {
> > > >         global $levelMarker;
>
> > > >         foreach ($array as $key => $value) {
> > > >             if (is_array($value)) {
> > > >                 echo $level . $key;
> > > >                 echo '';
> > > >                 outputMenu($value, $level . $levelMarker);
> > > >             } else {
> > > >                 echo $html->link("$level$key", $value);
> > > >                 echo '';
> > > >             }
> > > >         }
> > > >         echo "";
> > > >     }
>
> > > >     //output menu settings
> > > >     $levelMarker = '-';
> > > >     $level = '';
> > > >     $linkTreeSimple = array();
>
> > > >     //output menu
> > > >     outputMenu($linkTree, $level);
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HTML helper in function?

2009-08-11 Thread JamesF

if you have time would you mind posting a test case or example code? i
would love to see some more of the code in context just so I can
improve my understanding of the issue.

please let us know what works in the end for you it might help someone
in the future

On Aug 12, 1:09 am, Josh  wrote:
> It works fine outside of the function. I've run into this before;
> helper functions not working within View functions. Are you sure
> you've had that work in the past?
>
> I think the issue is that you normally (in models, controllers,
> components...) need to reference the object where the function is
> located with $this-> in order to access functions accessible to the
> whole object. However, View files don't typically have their own
> classes and objects (excluding helpers) since most of the logic is
> handled elsewhere in the app.  Therefore, you get either an unknown
> method error or non-object error.
>
> I think I will throw this all in an array -> menu helper with the Html
> helper. That way I'll be able to reference the object with the link()
> function.
>
> Thanks for your help.
>
> On Aug 11, 11:15 pm, JamesF  wrote:
>
> > hmm im not sure if this will work but you could try in your element:
>
> > App:import('Helper', Html');
>
> > $html = new html();
>
> > does html helper work in other parts of your element outside the
> > function? i usually have no problems at all using $html->link() within
> > an element function.
>
> > On Aug 11, 10:47 pm, Josh  wrote:
>
> > > The helpers are set and work fine. However, $html->link() does not
> > > work when called within a function in the view.
>
> > > As for where the logic is written: this is an element that appears in
> > > all admin tools throughout the site. requestAction() would allow me to
> > > put some of the logic in the controller, however since this is an
> > > array used only for constructing a menu, I don't really see any
> > > advantage to that.
>
> > > On Aug 11, 7:15 pm, JamesF  wrote:
>
> > > > if your controller is set up with var $helpers = array('html') ; you
> > > > should be fine..that error is just telling you that cake can't find
> > > > HtmlHelper...is there a reason you are executing that logic in your
> > > > view and not the controller?
>
> > > > On Aug 11, 7:02 pm, Josh  wrote:
>
> > > > > Hi,
>
> > > > > I have the contents of a tree menu stored in a multi-dimensional
> > > > > array. The number of dimensions is not fixed, so to turn the array
> > > > > into a menu in the View file, I have set up a recurring function. This
> > > > > works fine except that I can't call the $html->link() from the
> > > > > function.
>
> > > > > Fatal error: Call to a member function link() on a non-object in...
>
> > > > > Any ideas? Is there a way to make the link() function global as you do
> > > > > a variable? There are some obvious work-arounds such as writing the
> > > > > anchor tag without the html helper, or turning the link array into a
> > > > > simpler two dimensional array where I can then iterate the link()
> > > > > function. However, I am wonder how I might specifically address the
> > > > > question of making the html->link() function available to a function
> > > > > within a view file.
>
> > > > > I have a feeling this is either going to be a simple declaration or
> > > > > not worth the trouble. Thanks in advance.
>
> > > > > Here is my code:
>
> > > > >     //array of links
> > > > >     key: link title
> > > > >     value: link location or sub-array
> > > > >     $linkTree = array(
> > > > >         'User Management' => array(
> > > > >             'Permissions' => array(
> > > > >                 'Set Permissions' => '/tools/setPermissions',
> > > > >                 'Update ACOS' => '/tools/updateacl',
> > > > >                 'View/Edit Groups' => '/admin/groups'
> > > > >             ),
> > > > >             'User Settings' => '/tools/userSettings',
> > > > >             'Users' => array(
> > > > >                 'List' => '/admin/users',
> > > > >                 'Add User' => '/admin/users/add'
> > > > >             )
> > > > >         )
> > > > >     );
>
> > > > >     //output menu function
> > > > >     function outputMenu ($array, $level) {
> > > > >         global $levelMarker;
>
> > > > >         foreach ($array as $key => $value) {
> > > > >             if (is_array($value)) {
> > > > >                 echo $level . $key;
> > > > >                 echo '';
> > > > >                 outputMenu($value, $level . $levelMarker);
> > > > >             } else {
> > > > >                 echo $html->link("$level$key", $value);
> > > > >                 echo '';
> > > > >             }
> > > > >         }
> > > > >         echo "";
> > > > >     }
>
> > > > >     //output menu settings
> > > > >     $levelMarker = '-';
> > > > >     $level = '';
> > > > >     $linkTreeSimple = array();
>
> > > > >     //output menu
> > > > >     outputMenu($linkTree, $level);
--~--~-~--~~~---~--~~
Yo

Re: HTML helper in function?

2009-08-11 Thread JamesF

hmm im not sure if this will work but you could try in your element:

App:import('Helper', Html');

$html = new html();

does html helper work in other parts of your element outside the
function? i usually have no problems at all using $html->link() within
an element function.

On Aug 11, 10:47 pm, Josh  wrote:
> The helpers are set and work fine. However, $html->link() does not
> work when called within a function in the view.
>
> As for where the logic is written: this is an element that appears in
> all admin tools throughout the site. requestAction() would allow me to
> put some of the logic in the controller, however since this is an
> array used only for constructing a menu, I don't really see any
> advantage to that.
>
> On Aug 11, 7:15 pm, JamesF  wrote:
>
> > if your controller is set up with var $helpers = array('html') ; you
> > should be fine..that error is just telling you that cake can't find
> > HtmlHelper...is there a reason you are executing that logic in your
> > view and not the controller?
>
> > On Aug 11, 7:02 pm, Josh  wrote:
>
> > > Hi,
>
> > > I have the contents of a tree menu stored in a multi-dimensional
> > > array. The number of dimensions is not fixed, so to turn the array
> > > into a menu in the View file, I have set up a recurring function. This
> > > works fine except that I can't call the $html->link() from the
> > > function.
>
> > > Fatal error: Call to a member function link() on a non-object in...
>
> > > Any ideas? Is there a way to make the link() function global as you do
> > > a variable? There are some obvious work-arounds such as writing the
> > > anchor tag without the html helper, or turning the link array into a
> > > simpler two dimensional array where I can then iterate the link()
> > > function. However, I am wonder how I might specifically address the
> > > question of making the html->link() function available to a function
> > > within a view file.
>
> > > I have a feeling this is either going to be a simple declaration or
> > > not worth the trouble. Thanks in advance.
>
> > > Here is my code:
>
> > >     //array of links
> > >     key: link title
> > >     value: link location or sub-array
> > >     $linkTree = array(
> > >         'User Management' => array(
> > >             'Permissions' => array(
> > >                 'Set Permissions' => '/tools/setPermissions',
> > >                 'Update ACOS' => '/tools/updateacl',
> > >                 'View/Edit Groups' => '/admin/groups'
> > >             ),
> > >             'User Settings' => '/tools/userSettings',
> > >             'Users' => array(
> > >                 'List' => '/admin/users',
> > >                 'Add User' => '/admin/users/add'
> > >             )
> > >         )
> > >     );
>
> > >     //output menu function
> > >     function outputMenu ($array, $level) {
> > >         global $levelMarker;
>
> > >         foreach ($array as $key => $value) {
> > >             if (is_array($value)) {
> > >                 echo $level . $key;
> > >                 echo '';
> > >                 outputMenu($value, $level . $levelMarker);
> > >             } else {
> > >                 echo $html->link("$level$key", $value);
> > >                 echo '';
> > >             }
> > >         }
> > >         echo "";
> > >     }
>
> > >     //output menu settings
> > >     $levelMarker = '-';
> > >     $level = '';
> > >     $linkTreeSimple = array();
>
> > >     //output menu
> > >     outputMenu($linkTree, $level);
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HTML helper in function?

2009-08-11 Thread JamesF

hmm im not sure if this will work but you could try in your element:

App:import('Helper', Html');

$html = new html();

On Aug 11, 10:47 pm, Josh  wrote:
> The helpers are set and work fine. However, $html->link() does not
> work when called within a function in the view.
>
> As for where the logic is written: this is an element that appears in
> all admin tools throughout the site. requestAction() would allow me to
> put some of the logic in the controller, however since this is an
> array used only for constructing a menu, I don't really see any
> advantage to that.
>
> On Aug 11, 7:15 pm, JamesF  wrote:
>
> > if your controller is set up with var $helpers = array('html') ; you
> > should be fine..that error is just telling you that cake can't find
> > HtmlHelper...is there a reason you are executing that logic in your
> > view and not the controller?
>
> > On Aug 11, 7:02 pm, Josh  wrote:
>
> > > Hi,
>
> > > I have the contents of a tree menu stored in a multi-dimensional
> > > array. The number of dimensions is not fixed, so to turn the array
> > > into a menu in the View file, I have set up a recurring function. This
> > > works fine except that I can't call the $html->link() from the
> > > function.
>
> > > Fatal error: Call to a member function link() on a non-object in...
>
> > > Any ideas? Is there a way to make the link() function global as you do
> > > a variable? There are some obvious work-arounds such as writing the
> > > anchor tag without the html helper, or turning the link array into a
> > > simpler two dimensional array where I can then iterate the link()
> > > function. However, I am wonder how I might specifically address the
> > > question of making the html->link() function available to a function
> > > within a view file.
>
> > > I have a feeling this is either going to be a simple declaration or
> > > not worth the trouble. Thanks in advance.
>
> > > Here is my code:
>
> > >     //array of links
> > >     key: link title
> > >     value: link location or sub-array
> > >     $linkTree = array(
> > >         'User Management' => array(
> > >             'Permissions' => array(
> > >                 'Set Permissions' => '/tools/setPermissions',
> > >                 'Update ACOS' => '/tools/updateacl',
> > >                 'View/Edit Groups' => '/admin/groups'
> > >             ),
> > >             'User Settings' => '/tools/userSettings',
> > >             'Users' => array(
> > >                 'List' => '/admin/users',
> > >                 'Add User' => '/admin/users/add'
> > >             )
> > >         )
> > >     );
>
> > >     //output menu function
> > >     function outputMenu ($array, $level) {
> > >         global $levelMarker;
>
> > >         foreach ($array as $key => $value) {
> > >             if (is_array($value)) {
> > >                 echo $level . $key;
> > >                 echo '';
> > >                 outputMenu($value, $level . $levelMarker);
> > >             } else {
> > >                 echo $html->link("$level$key", $value);
> > >                 echo '';
> > >             }
> > >         }
> > >         echo "";
> > >     }
>
> > >     //output menu settings
> > >     $levelMarker = '-';
> > >     $level = '';
> > >     $linkTreeSimple = array();
>
> > >     //output menu
> > >     outputMenu($linkTree, $level);
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HTML helper in function?

2009-08-11 Thread Josh

The helpers are set and work fine. However, $html->link() does not
work when called within a function in the view.

As for where the logic is written: this is an element that appears in
all admin tools throughout the site. requestAction() would allow me to
put some of the logic in the controller, however since this is an
array used only for constructing a menu, I don't really see any
advantage to that.

On Aug 11, 7:15 pm, JamesF  wrote:
> if your controller is set up with var $helpers = array('html') ; you
> should be fine..that error is just telling you that cake can't find
> HtmlHelper...is there a reason you are executing that logic in your
> view and not the controller?
>
> On Aug 11, 7:02 pm, Josh  wrote:
>
>
>
> > Hi,
>
> > I have the contents of a tree menu stored in a multi-dimensional
> > array. The number of dimensions is not fixed, so to turn the array
> > into a menu in the View file, I have set up a recurring function. This
> > works fine except that I can't call the $html->link() from the
> > function.
>
> > Fatal error: Call to a member function link() on a non-object in...
>
> > Any ideas? Is there a way to make the link() function global as you do
> > a variable? There are some obvious work-arounds such as writing the
> > anchor tag without the html helper, or turning the link array into a
> > simpler two dimensional array where I can then iterate the link()
> > function. However, I am wonder how I might specifically address the
> > question of making the html->link() function available to a function
> > within a view file.
>
> > I have a feeling this is either going to be a simple declaration or
> > not worth the trouble. Thanks in advance.
>
> > Here is my code:
>
> >     //array of links
> >     key: link title
> >     value: link location or sub-array
> >     $linkTree = array(
> >         'User Management' => array(
> >             'Permissions' => array(
> >                 'Set Permissions' => '/tools/setPermissions',
> >                 'Update ACOS' => '/tools/updateacl',
> >                 'View/Edit Groups' => '/admin/groups'
> >             ),
> >             'User Settings' => '/tools/userSettings',
> >             'Users' => array(
> >                 'List' => '/admin/users',
> >                 'Add User' => '/admin/users/add'
> >             )
> >         )
> >     );
>
> >     //output menu function
> >     function outputMenu ($array, $level) {
> >         global $levelMarker;
>
> >         foreach ($array as $key => $value) {
> >             if (is_array($value)) {
> >                 echo $level . $key;
> >                 echo '';
> >                 outputMenu($value, $level . $levelMarker);
> >             } else {
> >                 echo $html->link("$level$key", $value);
> >                 echo '';
> >             }
> >         }
> >         echo "";
> >     }
>
> >     //output menu settings
> >     $levelMarker = '-';
> >     $level = '';
> >     $linkTreeSimple = array();
>
> >     //output menu
> >     outputMenu($linkTree, $level);
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HTML helper in function?

2009-08-11 Thread JamesF

if your controller is set up with var $helpers = array('html') ; you
should be fine..that error is just telling you that cake can't find
HtmlHelper...is there a reason you are executing that logic in your
view and not the controller?

On Aug 11, 7:02 pm, Josh  wrote:
> Hi,
>
> I have the contents of a tree menu stored in a multi-dimensional
> array. The number of dimensions is not fixed, so to turn the array
> into a menu in the View file, I have set up a recurring function. This
> works fine except that I can't call the $html->link() from the
> function.
>
> Fatal error: Call to a member function link() on a non-object in...
>
> Any ideas? Is there a way to make the link() function global as you do
> a variable? There are some obvious work-arounds such as writing the
> anchor tag without the html helper, or turning the link array into a
> simpler two dimensional array where I can then iterate the link()
> function. However, I am wonder how I might specifically address the
> question of making the html->link() function available to a function
> within a view file.
>
> I have a feeling this is either going to be a simple declaration or
> not worth the trouble. Thanks in advance.
>
> Here is my code:
>
>     //array of links
>     key: link title
>     value: link location or sub-array
>     $linkTree = array(
>         'User Management' => array(
>             'Permissions' => array(
>                 'Set Permissions' => '/tools/setPermissions',
>                 'Update ACOS' => '/tools/updateacl',
>                 'View/Edit Groups' => '/admin/groups'
>             ),
>             'User Settings' => '/tools/userSettings',
>             'Users' => array(
>                 'List' => '/admin/users',
>                 'Add User' => '/admin/users/add'
>             )
>         )
>     );
>
>     //output menu function
>     function outputMenu ($array, $level) {
>         global $levelMarker;
>
>         foreach ($array as $key => $value) {
>             if (is_array($value)) {
>                 echo $level . $key;
>                 echo '';
>                 outputMenu($value, $level . $levelMarker);
>             } else {
>                 echo $html->link("$level$key", $value);
>                 echo '';
>             }
>         }
>         echo "";
>     }
>
>     //output menu settings
>     $levelMarker = '-';
>     $level = '';
>     $linkTreeSimple = array();
>
>     //output menu
>     outputMenu($linkTree, $level);
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HTML Helper issue in Blog Tute

2009-02-07 Thread Alfredo Quiroga-Villamil

Do you have var $helpers = array('Html') in your controller or AppController ?

Regards,

Alfredo

On Sat, Feb 7, 2009 at 9:41 AM, jim  wrote:
>
>  This is not showing as a link in my browser:
>
> link($post['Post']['title'], "/posts/view/".$post
> ['Post']['id']); ?>
>
>
> Just looks like this:
> link($post['Post']['title'], "/posts/view/".$post['Post']['id']); ?>
>
>
> Any ideas? I'm new to Cake and I assume it's a helper issue.
> I am not sure wheter the tute is for 1.1, 1.2, or both.
> Pls help.
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: html helper issue

2008-10-01 Thread Samuel DeVore

On Wed, Oct 1, 2008 at 9:32 AM, soosa <[EMAIL PROTECTED]> wrote:
> Thanks for your reply Lance!
>
> but still this is not a good way to handle this issue, at least because the
> code in the view will be ugly since some metas have been generated by cake
> and others you should put them in plain hard coding!
> i already did it as you said but IMHO i still think that the missing metas
> must be implemented by cake to complete the bundle!

That is great that you think that, and you should go ahead and open a
ticket at https://trac.cakephp.org/  if you submit a patch even
better.  Because without opening a ticket it will likely never happen
;)

S
>
> Thanks again.
>
> On Wed, Oct 1, 2008 at 11:22 AM, Lance Willett <[EMAIL PROTECTED]> wrote:
>>
>> > is there any way to generate the output for those metas as dealing with
>> > description and
>> > keywords metas?
>>
>> Hi soosa,
>>
>> The "meta" HTML helper currently supports building meta elements for
>> "rss", "icon", "atom", "keywords", and "description". For all the
>> other types of meta elements, you are better off inserting them in
>> plain old HTML, which is what I do for all meta elements, anyway. You
>> can still use dynamic elements in the meta content area, like "> echo $title_for_layout ?>" to insert the current page title.
>>
>> See the meta API reference here:
>>
>> http://api.cakephp.org/1.2/class_html_helper.html#9489839503311b5167336ae0abdd0f8a
>> and the accepted types on line 200 of file html.php (http://
>> api.cakephp.org/1.2/html_8php-source.html#l00200).
>>
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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?hl=en
-~--~~~~--~~--~--~---



Re: html helper issue

2008-10-01 Thread soosa
Thanks for your reply Lance!

but still this is not a good way to handle this issue, at least because the
code in the view will be ugly since some metas have been generated by cake
and others you should put them in plain hard coding!
i already did it as you said but IMHO i still think that the missing metas
must be implemented by cake to complete the bundle!

Thanks again.

On Wed, Oct 1, 2008 at 11:22 AM, Lance Willett <[EMAIL PROTECTED]> wrote:

>
> > is there any way to generate the output for those metas as dealing with
> description and
> > keywords metas?
>
> Hi soosa,
>
> The "meta" HTML helper currently supports building meta elements for
> "rss", "icon", "atom", "keywords", and "description". For all the
> other types of meta elements, you are better off inserting them in
> plain old HTML, which is what I do for all meta elements, anyway. You
> can still use dynamic elements in the meta content area, like " echo $title_for_layout ?>" to insert the current page title.
>
> See the meta API reference here:
>
> http://api.cakephp.org/1.2/class_html_helper.html#9489839503311b5167336ae0abdd0f8a
> and the accepted types on line 200 of file html.php (http://
> api.cakephp.org/1.2/html_8php-source.html#l00200).
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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?hl=en
-~--~~~~--~~--~--~---



Re: html helper issue

2008-10-01 Thread Lance Willett

> is there any way to generate the output for those metas as dealing with 
> description and
> keywords metas?

Hi soosa,

The "meta" HTML helper currently supports building meta elements for
"rss", "icon", "atom", "keywords", and "description". For all the
other types of meta elements, you are better off inserting them in
plain old HTML, which is what I do for all meta elements, anyway. You
can still use dynamic elements in the meta content area, like "" to insert the current page title.

See the meta API reference here:
http://api.cakephp.org/1.2/class_html_helper.html#9489839503311b5167336ae0abdd0f8a
and the accepted types on line 200 of file html.php (http://
api.cakephp.org/1.2/html_8php-source.html#l00200).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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?hl=en
-~--~~~~--~~--~--~---



Re: Html Helper

2008-09-19 Thread nayan

But When i have two model like User and UserType and in Users
controller right now i am using only UserType model so in the add.ctp
i metion  create('UserType',
> > array('action' => 'admin_add')); ?> it give me error "Controller missing"


On Sep 12, 6:43 pm, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
> > $form->create(string $model = null, array $options = array());
>
> from:http://book.cakephp.org/view/183/Creating-Forms
>
> On 12 Sep 2008, at 13:16,nayanwrote:
>
>
>
> > Thank you for reply.i wana to ask you one thing that i didnt fine any
> > where,we create form like this "create('Setting',
> > array('action' => 'admin_edit')); ?>" .Tell me first stands for what
> > (Here Seeting) means it is controller name or model name 
>
> > On Sep 10, 7:16 pm, "Luiz Poleto" <[EMAIL PROTECTED]> wrote:
> >> Also, forget about using 'FanType/fantype_name'. Although it's still
> >> supported, now the correct way to use it is 'FanType.fantype_name'.
> >> Regards,
> >> Luiz Poleto
>
> >> 2008/9/10nayan<[EMAIL PROTECTED]>
>
> >>> I am using cake 1.2 .When i use "echo $html->input('FanType/
> >>> fantype_name')" in my form.it give me the following error
> >>> "Method HtmlHelper::input does not exist [CORE\cake\libs\view
> >>> \helper.php, line 148]".can we use html helper in cake 1.2 ?
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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?hl=en
-~--~~~~--~~--~--~---



Re: Html Helper

2008-09-12 Thread David C. Zentgraf

> $form->create(string $model = null, array $options = array());

from: http://book.cakephp.org/view/183/Creating-Forms

On 12 Sep 2008, at 13:16, nayan wrote:

>
> Thank you for reply.i wana to ask you one thing that i didnt fine any
> where,we create form like this "create('Setting',
> array('action' => 'admin_edit')); ?>" .Tell me first stands for what
> (Here Seeting) means it is controller name or model name 
>
> On Sep 10, 7:16 pm, "Luiz Poleto" <[EMAIL PROTECTED]> wrote:
>> Also, forget about using 'FanType/fantype_name'. Although it's still
>> supported, now the correct way to use it is 'FanType.fantype_name'.
>> Regards,
>> Luiz Poleto
>>
>> 2008/9/10 nayan <[EMAIL PROTECTED]>
>>
>>
>>
>>> I am using cake 1.2 .When i use "echo $html->input('FanType/
>>> fantype_name')" in my form.it give me the following error
>>> "Method HtmlHelper::input does not exist [CORE\cake\libs\view
>>> \helper.php, line 148]".can we use html helper in cake 1.2 ?
>>
>>
>
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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?hl=en
-~--~~~~--~~--~--~---



Re: Html Helper

2008-09-12 Thread nayan

Thank you for reply.i wana to ask you one thing that i didnt fine any
where,we create form like this "create('Setting',
array('action' => 'admin_edit')); ?>" .Tell me first stands for what
(Here Seeting) means it is controller name or model name 

On Sep 10, 7:16 pm, "Luiz Poleto" <[EMAIL PROTECTED]> wrote:
> Also, forget about using 'FanType/fantype_name'. Although it's still
> supported, now the correct way to use it is 'FanType.fantype_name'.
> Regards,
> Luiz Poleto
>
> 2008/9/10 nayan <[EMAIL PROTECTED]>
>
>
>
> > I am using cake 1.2 .When i use "echo $html->input('FanType/
> > fantype_name')" in my form.it give me the following error
> > "Method HtmlHelper::input does not exist [CORE\cake\libs\view
> > \helper.php, line 148]".can we use html helper in cake 1.2 ?
>
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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?hl=en
-~--~~~~--~~--~--~---



Re: Html Helper

2008-09-10 Thread Luiz Poleto
Also, forget about using 'FanType/fantype_name'. Although it's still
supported, now the correct way to use it is 'FanType.fantype_name'.
Regards,
Luiz Poleto

2008/9/10 nayan <[EMAIL PROTECTED]>

>
> I am using cake 1.2 .When i use "echo $html->input('FanType/
> fantype_name')" in my form.it give me the following error
> "Method HtmlHelper::input does not exist [CORE\cake\libs\view
> \helper.php, line 148]".can we use html helper in cake 1.2 ?
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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?hl=en
-~--~~~~--~~--~--~---



Re: Html Helper

2008-09-10 Thread Donkeybob

yes . . .just as john said . . .its $form->input.

On Sep 10, 9:22 am, John David Anderson <[EMAIL PROTECTED]>
wrote:
> On Sep 10, 2008, at 1:35 AM, nayan wrote:
>
>
>
> > I am using cake 1.2 .When i use "echo $html->input('FanType/
> > fantype_name')" in my form.it give me the following error
> > "Method HtmlHelper::input does not exist [CORE\cake\libs\view
> > \helper.php, line 148]".can we use html helper in cake 1.2 ?
>
> Yes, but you use the FormHelper in 1.2 for forms. :)
>
> -- John
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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?hl=en
-~--~~~~--~~--~--~---



Re: Html Helper

2008-09-10 Thread John David Anderson

On Sep 10, 2008, at 1:35 AM, nayan wrote:

>
> I am using cake 1.2 .When i use "echo $html->input('FanType/
> fantype_name')" in my form.it give me the following error
> "Method HtmlHelper::input does not exist [CORE\cake\libs\view
> \helper.php, line 148]".can we use html helper in cake 1.2 ?

Yes, but you use the FormHelper in 1.2 for forms. :)

-- John

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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?hl=en
-~--~~~~--~~--~--~---



Re: Html Helper get wrong!!

2008-06-24 Thread [EMAIL PROTECTED]

thank you Daniel !
thank you Hannibal !

dr. Hannibal Lecter wrote:
> Also, be sure to use a dot instead of a slash:
>
> $form->input('Artist.name');
>
> Happy baking!
>
> On Jun 24, 11:51�am, Daniel Hofstetter <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > > i get use the new cake version 1.2.0.7125 RC1,
> >
> > > i code the Html helper like before:
> >
> > > input('Artist/name');?>
> >
> > > but it got html:
> >
> > > 
> >
> > > could somebody tell me how should i do?
> >
> > HtmlHelper::input() is deprecated and shouldn't be used anymore. Most
> > of it's functionality is now in the FormHelper, 
> > seehttp://book.cakephp.org/view/182/form
> >
> > Hope that helps!
> >
> > --
> > Daniel Hofstetterhttp://cakebaker.42dh.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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?hl=en
-~--~~~~--~~--~--~---



Re: Html Helper get wrong!!

2008-06-24 Thread dr. Hannibal Lecter

Also, be sure to use a dot instead of a slash:

$form->input('Artist.name');

Happy baking!

On Jun 24, 11:51 am, Daniel Hofstetter <[EMAIL PROTECTED]> wrote:
> Hi,
>
> > i get use the new cake version 1.2.0.7125 RC1,
>
> > i code the Html helper like before:
>
> > input('Artist/name');?>
>
> > but it got html:
>
> > 
>
> > could somebody tell me how should i do?
>
> HtmlHelper::input() is deprecated and shouldn't be used anymore. Most
> of it's functionality is now in the FormHelper, 
> seehttp://book.cakephp.org/view/182/form
>
> Hope that helps!
>
> --
> Daniel Hofstetterhttp://cakebaker.42dh.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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?hl=en
-~--~~~~--~~--~--~---



Re: Html Helper get wrong!!

2008-06-24 Thread Daniel Hofstetter

Hi,

> i get use the new cake version 1.2.0.7125 RC1,
>
> i code the Html helper like before:
>
> input('Artist/name');?>
>
> but it got html:
>
> 
>
> could somebody tell me how should i do?

HtmlHelper::input() is deprecated and shouldn't be used anymore. Most
of it's functionality is now in the FormHelper, see 
http://book.cakephp.org/view/182/form

Hope that helps!

--
Daniel Hofstetter
http://cakebaker.42dh.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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?hl=en
-~--~~~~--~~--~--~---



Re: Html Helper link onclick option question

2008-05-22 Thread fr3nch13

You have to turn off the escaping in the link functions, it auto
escapes.

Check out:

http://www.donutczar.com/blog/?p=4
http://api.cakephp.org/1.2/class_html_helper.html

On May 22, 4:56 am, jimbo <[EMAIL PROTECTED]> wrote:
> Hi,
>
> can anybody help me with this problem, I am creating a simple link in
> one of my views and I am having a problem giving an onClick option/
> attribute for the link, as it seems cake is escaping/encoding the
> javascript function special characters like this:
>
> echo $html->link("foo", '#',
> array('onClick'=>"myObj.select(document.getElementById('".
> $element."')); return false;"));
>
> prints out something like:
>
>  onClick="myObj.select(document.getElementById('element0'));
> return false;">foo
>
> On the view, I have specified to use ISO-8859-1 encoding, is this the
> problem?
>
> 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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?hl=en
-~--~~~~--~~--~--~---



Re: HTML Helper webroot not correct

2008-05-22 Thread Dardo Sordi Bogado

It's documented since a long time ago:

CakePHP 1.2:
http://book.cakephp.org/view/32/installation

CakePHP 1.1:
http://manual.cakephp.org/view/308/installing-cakephp

On Wed, May 21, 2008 at 10:34 AM, Joel Perras <[EMAIL PROTECTED]> wrote:
>
> Add the line:
>
> RewriteBase  /~user/
>
> to the .htaccess files that already exist in your cake installation.
> They should be found in app/.htaccess and app/webroot/.htaccess (this
> last one may be redundant).  Assuming you haven't changed the location
> of any Cake folders and files, this should solve your problem.  If you
> want to know why this is needed, you can check out 
> http://preview.tinyurl.com/5t32yg
> .
>
> -Joel.
>
> On May 21, 4:26 am, Tobes <[EMAIL PROTECTED]> wrote:
>> Joel,
>>
>> Thanks for the advice, but I am not sure what to set it to.
>>
>> The site is currently in folder on URLhttp://localhost/~user/cakephptest/...
>>
>> The images that the default layout includes are referencing 
>> tohttp://localhost/imgrather thanhttp://localhost/~user/cakephptest/img
>>
>> Can you advise what I need to put in the htaccess file?
>>
>> Thanks,
>>
>> Toby
>>
>> On May 21, 4:19 am, Joel Perras <[EMAIL PROTECTED]> wrote:
>>
>> > Set a RewriteBase condition in your .htaccess files in app/.htaccess
>> > and app/webroot/.htaccess.
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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?hl=en
-~--~~~~--~~--~--~---



Re: HTML Helper webroot not correct

2008-05-21 Thread Joel Perras

Add the line:

RewriteBase  /~user/

to the .htaccess files that already exist in your cake installation.
They should be found in app/.htaccess and app/webroot/.htaccess (this
last one may be redundant).  Assuming you haven't changed the location
of any Cake folders and files, this should solve your problem.  If you
want to know why this is needed, you can check out 
http://preview.tinyurl.com/5t32yg
.

-Joel.

On May 21, 4:26 am, Tobes <[EMAIL PROTECTED]> wrote:
> Joel,
>
> Thanks for the advice, but I am not sure what to set it to.
>
> The site is currently in folder on URLhttp://localhost/~user/cakephptest/...
>
> The images that the default layout includes are referencing 
> tohttp://localhost/imgrather thanhttp://localhost/~user/cakephptest/img
>
> Can you advise what I need to put in the htaccess file?
>
> Thanks,
>
> Toby
>
> On May 21, 4:19 am, Joel Perras <[EMAIL PROTECTED]> wrote:
>
> > Set a RewriteBase condition in your .htaccess files in app/.htaccess
> > and app/webroot/.htaccess.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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?hl=en
-~--~~~~--~~--~--~---



Re: HTML Helper webroot not correct

2008-05-21 Thread Tobes

Joel,

Thanks for the advice, but I am not sure what to set it to.

The site is currently in folder on URL http://localhost/~user/cakephptest/...

The images that the default layout includes are referencing to
http://localhost/img rather than http://localhost/~user/cakephptest/img

Can you advise what I need to put in the htaccess file?

Thanks,

Toby


On May 21, 4:19 am, Joel Perras <[EMAIL PROTECTED]> wrote:
> Set a RewriteBase condition in your .htaccess files in app/.htaccess
> and app/webroot/.htaccess.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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?hl=en
-~--~~~~--~~--~--~---



Re: HTML Helper webroot not correct

2008-05-20 Thread Joel Perras

Set a RewriteBase condition in your .htaccess files in app/.htaccess
and app/webroot/.htaccess.

On May 20, 7:49 pm, Tobes <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I've just started playing with CakePHP & have found that, because I'm
> not using a domain name to access my site, but instead using a sub-
> folder, the HTML helper is using / as the webroot, rather than the sub-
> folder the site is in.
>
> Any advice on how to correct this welcomed.
>
> Thanks,
>
> T
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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?hl=en
-~--~~~~--~~--~--~---



Re: HTML Helper - flash support

2008-02-03 Thread MrTufty

Unlikely.

My theory on this, others may disagree, is that Flash is better added
by the theory of progressive enhancement. That's why I use jQuery plus
the jQuery Flash plugin to handle it at the client side. I'm pretty
sure other libraries have similar solutions.

Steve

On Feb 1, 11:00 pm, Ata Alqadi <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I needed to use flash files in my site, so i wrote the following
> function:
>
> function flash($path, $name, $width, $height, $scale = "exactfit",
> $wmode = "transparent"){
> if (is_array($path)) {
> $path = Router::url($path);
> } elseif ($path{0} === '/') {
> $path = $this->webroot($path);
> } elseif (strpos($path, '://') !== false) {
> $path = $path;
> } else {
> if (Configure::read('Asset.timestamp') == true && 
> Configure::read()> 0) {
>
> $path .= '?' . @filemtime(str_replace('/', DS, 
> WWW_ROOT .
> FLASHES_URL . $path));
> }
> $path = $this->webroot(FLASHES_URL . $path);
> }
>
> return '

Re: html helper: Akamai for images?

2007-07-25 Thread Grant Cox

You can pass a full path to the HTML helper image function.

echo $html->image( 'http://cakephp.org/img/cake.power.png',
array('alt'=>'CakePHP!') );


On Jul 26, 12:24 pm, Beth <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've got a client who is using Akamai for hosting their images (tons
> of photos). Does anyone have a html helper that supports specifying
> the full image src instead of cake's relative path?
>
> Thanks!


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: html helper: not valid xhtml

2007-04-25 Thread Damien

Presumably you should be using 'password' instead of 'input' anyway
for the above example?

'password' => ''

I'm using 1.1.14 stable and my standard input fields are coming out
fine... (i.e. with the />) - what code are you using in your view to
generate the offending (non XHTML)?

Damien


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: html helper: not valid xhtml

2007-04-25 Thread majna

Cake version is 1.1.15.4852 -latest nightly, same problem with  1.1.14
stable
tnx


On Apr 25, 9:00 pm, majna <[EMAIL PROTECTED]> wrote:
> There is page in output (source):
>  value="" type="password">
>
> Notice closing tag: without />
>
> In cake\libs\view\helper.php
> "input" is defined like this:
> 'input' => '',
>
> So where could be a probelm here?


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



RE: HTML Helper UTF-8 Issue

2006-12-18 Thread Mariano Iglesias

Jeez, I need to learn chinese. What was that you put there?

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!

-Mensaje original-
De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de meek
Enviado el: Lunes, 18 de Diciembre de 2006 11:17 a.m.
Para: Cake PHP
Asunto: Re: HTML Helper UTF-8 Issue

what a friendly '交流群' this is!


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: HTML Helper UTF-8 Issue

2006-12-18 Thread meek

ok. i understand now - i didn't get that the characters already are
entities. thanks for the explanation. what a friendly '交流群' this
is!


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: HTML Helper UTF-8 Issue

2006-12-18 Thread uzyn

Yup meek. I did extend my own class. I do not like to hack files in
cake directory as well.

The problem here is because of MySQL integration. When data is grabbed
straight away from MySQL, it is grabbed as string of UTF-8 numbers
(with the &#). The h() function would have change the & to HTML entity
(&) instead of passing it directly to the the browser as a whole
UTF-8 character.

I hope I explained it clearly.

BTW, the 3 chinese characters mean 'interaction group'. Nothing rude
here. :)

On Dec 18, 9:48 pm, "meek" <[EMAIL PROTECTED]> wrote:
> Glad you found a solution, but I'm still confused. Maybe it's something
> to do with bake which I haven't used.
> if i put this in a view:
>
>  polite ?>
>
> I don't get any entities.  As I wrote above, AFAIK, the
> htmlspecialchars function -  the function used in 'h' - only replaces a
> few entities (ampersand, corner brackets etc).
>
> I think it's good to avoid changing anything in the cake directory, and
> I think the h() function is in there for a good reason. Another way of
> solving the problem might be to extend the HtmlHelper with your own
> class:
>
> http://groups.google.de/group/cake-php/browse_frm/thread/75e0d9ae6ad6...
>
> - You could override the methods that are causing you problems, or add
> new methods with the required functionality.


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: HTML Helper UTF-8 Issue

2006-12-18 Thread meek

Glad you found a solution, but I'm still confused. Maybe it's something
to do with bake which I haven't used.
if i put this in a view:



I don't get any entities.  As I wrote above, AFAIK, the
htmlspecialchars function -  the function used in 'h' - only replaces a
few entities (ampersand, corner brackets etc).

I think it's good to avoid changing anything in the cake directory, and
I think the h() function is in there for a good reason. Another way of
solving the problem might be to extend the HtmlHelper with your own
class:

http://groups.google.de/group/cake-php/browse_frm/thread/75e0d9ae6ad6b8c6/0416b42514fa2d3c?lnk=gst&q=Replacing+Html+Helper&rnum=1#0416b42514fa2d3c

- You could override the methods that are causing you problems, or add
new methods with the required functionality.


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: HTML Helper UTF-8 Issue

2006-12-18 Thread uzyn

meek,

Thanks for your response. It is certainly what is happening to me,
using the view files generated by bake. The UTF character would be
shown as 中

The '&' character is converted to HTML entity.

This happens to me at least in $html->input and $html->selectTag. I did
not test other functions.

For input, it is fixed by simply adding the 'value' attribute, ie.:
input('Node/name', array('size' => '60',
'value'=>$this->data['Node']['name']));?>

from the original problematic:
input('Node/name', array('size' => '60');?>


meek wrote:
> I'm probably missing something, but are you sure this is a problem with
> the html helper? I just built a form using it and had no problems with
> chinese characters in field values being turned into entities (I always
> use UTF-8). As far as I can see, the html helper will only
> automatically turn a few characters into entities using the
> 'htmlspecialchars' function. In fact it's only the 'link' function that
> uses 'htmlentities' - and that can be turned off as noted above.


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: HTML Helper UTF-8 Issue

2006-12-18 Thread uzyn

I have found out the cause of this problem. It's due to the use of h()
functions. Simply remove the use h() in input() and selectTag() in HTML
Helper would solve this problem.

Not sure should I submit this fix to the repository.


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: HTML Helper UTF-8 Issue

2006-12-18 Thread meek

I'm probably missing something, but are you sure this is a problem with
the html helper? I just built a form using it and had no problems with
chinese characters in field values being turned into entities (I always
use UTF-8). As far as I can see, the html helper will only
automatically turn a few characters into entities using the
'htmlspecialchars' function. In fact it's only the 'link' function that
uses 'htmlentities' - and that can be turned off as noted above.


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: HTML Helper UTF-8 Issue

2006-12-17 Thread uzyn

Thanks rdoggsv, I guess I'll have to do the same as well.

On Dec 18, 7:03 am, "rdoggsv" <[EMAIL PROTECTED]> wrote:
> I had this question some time ago, but i didnt ask, i started using
> normal html tags to do the job , but i really hope u get some answers
> as this would help a lot.
> 
> I wasnt using chinese character but spanish, and same problem.


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: HTML Helper UTF-8 Issue

2006-12-17 Thread uzyn

Thanks MI, only link() has that feature, not other functions in HTML
helper.


On Dec 18, 7:10 am, "Mariano Iglesias" <[EMAIL PROTECTED]>
wrote:
> Look for the parameters of the html helper functions you are using, IMO all
> of them have a way for you to disable entity encoding. For example, look at
> the last parameter of the link() function.
>
> -MI
>
> ---
>
> Remember, smart coders answer ten questions for every question they ask.
> So be smart, be cool, and share your knowledge.
>
> BAKE ON!
>
> -Mensaje original-
> De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
> de rdoggsv
> Enviado el: Domingo, 17 de Diciembre de 2006 08:04 p.m.
> Para: Cake PHP
> Asunto: Re: HTML Helper UTF-8 Issue
>
> I had this question some time ago, but i didnt ask, i started using
> normal html tags to do the job , but i really hope u get some answers
> as this would help a lot.
> 
> I wasnt using chinese character but spanish, and same problem.


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



RE: HTML Helper UTF-8 Issue

2006-12-17 Thread Mariano Iglesias

Look for the parameters of the html helper functions you are using, IMO all
of them have a way for you to disable entity encoding. For example, look at
the last parameter of the link() function.

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!


-Mensaje original-
De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de rdoggsv
Enviado el: Domingo, 17 de Diciembre de 2006 08:04 p.m.
Para: Cake PHP
Asunto: Re: HTML Helper UTF-8 Issue

I had this question some time ago, but i didnt ask, i started using
normal html tags to do the job , but i really hope u get some answers
as this would help a lot.

I wasnt using chinese character but spanish, and same problem.


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: HTML Helper UTF-8 Issue

2006-12-17 Thread rdoggsv

I had this question some time ago, but i didnt ask, i started using
normal html tags to do the job , but i really hope u get some answers
as this would help a lot.

I wasnt using chinese character but spanish, and same problem.


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: HTML helper error messages output

2006-10-15 Thread MicroAngelo

This is a functional work-around, but in answer to your original
question I would suggest that yes, this should be a feature request /
bug report, as the preferred way to do this would be to override
/cake/config/tags.ini.php with your own /app/config/tags.ini.php,
therefore $html->tagErrorMsg _should_ be modified to get its output
from tags.ini.php.


--~--~-~--~~~---~--~~
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: HTML helper error messages output

2006-10-13 Thread Christiaan Ottow

It does, thanks :-)


--~--~-~--~~~---~--~~
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: HTML helper error messages output

2006-10-06 Thread Mikee Freedom

yes, unfortunately that function doesn't use any of the snippets from
the tags.ini.

as i mentioned in the previous email, you may have to write your own
helper and include a function that modifies the output of the
tagErrorMsg function or replicates it using different HTML.

i've written a form helper which wraps my own HTML around the current
html helper form functions. i did it so i could easily output form
elements with different naming conventions if i needed to. was fun to
do.

does that make sense?

On 06/10/06, Christiaan Ottow <[EMAIL PROTECTED]> wrote:
>
> Thanks for your help guys.
>
> However, judged from the code in html.php, the HTML helper doesn't look
> at tags. If I'm wrong, which tag should I set in my custom tags.ini.php
> for the HTML helper to use it?
>
> Thanks in advance,
>
> Chris
>
>
> >
>

--~--~-~--~~~---~--~~
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: HTML helper error messages output

2006-10-06 Thread Christiaan Ottow

Thanks for your help guys.

However, judged from the code in html.php, the HTML helper doesn't look
at tags. If I'm wrong, which tag should I set in my custom tags.ini.php
for the HTML helper to use it?

Thanks in advance,

Chris


--~--~-~--~~~---~--~~
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: HTML helper error messages output

2006-10-04 Thread Mikee Freedom

ahhh i knew there must be a better way.

thanks gwoo.

On 05/10/06, gwoo <[EMAIL PROTECTED]> wrote:
>
> you could also create you own tags.ini.php and drop it in /app/config
> and that will override the cake core file.
>
> >
>

--~--~-~--~~~---~--~~
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: HTML helper error messages output

2006-10-04 Thread gwoo

you could also create you own tags.ini.php and drop it in /app/config  
and that will override the cake core file.

--~--~-~--~~~---~--~~
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: HTML helper error messages output

2006-10-04 Thread Mikee Freedom

morning mate,

i'm pretty sure you can access the HTML the HtmlHelper uses in the
following file:

/cake/config/tags.ini.php

actually, looking at it, tagErrorMsg is one of the only functions that
doesn't refer to this file at all.

in the HtmlHelper:

/cake/libs/views/helpers/html.php

you can see that it returns the following:

return sprintf('%s', is_array($text)
? (empty($text[$error - 1]) ? 'Error in field' : $text[$error - 1]) :
$text);

you *could* change it here but it's not recommended as next time you
update your Cake version you'll overwrite this.

what you could do instead is write your own helper that includes a
similar function. this could be a wrapper that removes the DIV or a
function very similar to this one. If you have a look at the function
you can see what it's doing and replicate it.

HTH
freedom

On 05/10/06, Christiaan Ottow <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> I'm running into a minor problem with cake. I use the
> $html->tagErrorMsg function to show error messages in user input. This
> function prints a  with class error_message. It seems like this
> output is hardcoded into the HTML helper.
> The problem is this: I want to mark errorous fields with a *, right
> behind the input box. Using $html->tagErrorMsg, the * will be on a new
> line since it prints a  first. Of course I could try solving this
> with the float:left CSS property or other hacks, but it would be better
> to fix this at the source.
>
> So, is there a way to set the error output strings without changing the
> source of cake (and having to patch it everytime from then)? Or should
> this be a feature request / bug report?
>
> Best regards,
>
> Chris
>
>
> >
>

--~--~-~--~~~---~--~~
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: Html helper emits id attribute that i don't want

2006-09-19 Thread [EMAIL PROTECTED]

I don't think Nate was flaming Dieter.  So, it shouldn't be a problem.
Nate was flaming all those people that want to configure and
reconfigure over and over again.  Those are the same people with
spaghetti code.  And even the ones that don't have spaghetti code, that
have studied well and make their own standards, wouldn't it be much
easier if they just used CakePHP which has standards which is what the
conventions are.  It is a standard way of outputting so you know what
to expect without having to type all over the place.

Before I found CakePHP I use to wonder how people can do open source, I
mean I realized it was good at getting the best result because the most
minds could work on it, but why not make money?  I just didn't get it.
Now, I found CakePHP and donate my monthly money, contribute to this
Google group, and worked hard to debug the code when it was RC and
preRC.  I did all this because I believed in CakePHP and it's mission.

I know that I myself often get frustrated with people who are new to
CakePHP and want it to do things the way they use to do them.  Back in
the days when they took months to write applications and ended up with
some level of spaghetti code just simply because it worked.  I also get
frustrated with people who are so quick to say, CakePHP is screwing up,
or not working right!  Instead of trying to actually debug their app,
discover the behaviour, become familiar with CakePHP and love it.  So
many people it seems forget that this is code, not life.  It follows a
predesigned set of rules.  The output is predictable.  And when you get
unpredicted results, you can debug it because there isn't chance, or
life in the equation.  Making any application work isn't the result of
throwing dice until it lands on 7.  It is the result of resolving
problems as they arise.  Every programming problem has a solution.  And
often it is simple and not that CakePHP is broken, but that you forgot
case sensitivity or didn't know how to turn off mod_rewrite in CakePHP.

So, it wasn't a flame, but an expression of angst against those that
just don't get it.  That don't realize that by following standards
(even if imposed by CakePHP) is much better way of coding than
reinventing the wheel from the ground up.


--~--~-~--~~~---~--~~
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: Html helper emits id attribute that i don't want

2006-09-19 Thread nate

> The above message from you to the list is almost a flame. Well, it is a
> flame.

I disagree.

> On purely neutral grounds -- as I would tend to agree with your opinion
> on this topic -- I've found that things work out better in a mailing
> list if people refrain from writing flames and almost-flames.

What I expressed was a strong opinion, which goes to the core of the
philosophy of this project, as well as my belief (which I stand by)
that people who do not agree with the philosophy of the project should
not use it.

Further, the expression of that opinion was not about or directed
towards any one person.  Rather, it was directed towards an idea, and
idea which runs counter to the philosophy of this project.  Once again,
this project has a very specific philosophy, and as such, very strong
opinions.  Therein lies the problem: it is difficult, if not
impossible, to have strong opinions without upsetting some people or
offending their sensibilities.  However, this is something I'm willing
to deal with.

Such is life.


--~--~-~--~~~---~--~~
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: Html helper emits id attribute that i don't want

2006-09-19 Thread [EMAIL PROTECTED]

nate wrote:
> Yes, you're right: the usual, dumb, wasteful approach to coding is that
> you have to explicitly specify every little thing you want your program
> to do.
>
> If that's how you want to write your code, you should not, I repeat
> *not* use CakePHP.  ...

Nate,

The above message from you to the list is almost a flame. Well, it is a
flame.

On purely neutral grounds -- as I would tend to agree with your opinion
on this topic -- I've found that things work out better in a mailing
list if people refrain from writing flames and almost-flames.

Of course, I also know how tense one can get with a busy mailing list!
It's exhausting, especially when the original group is overwhelmed by
newcomers.

Regards,

Ralph


--~--~-~--~~~---~--~~
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: Html helper emits id attribute that i don't want

2006-09-19 Thread [EMAIL PROTECTED]

No problems Dieter.  Just seemed so weird to us that use the natural id
and do AJAX daily with CakePHP.  Seemed like a no brainer to us.  You
really should try AJAX.  CakePHP makes it SO easy to implement.


--~--~-~--~~~---~--~~
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: Html helper emits id attribute that i don't want

2006-09-19 Thread [EMAIL PROTECTED]

Okay okay guys, you made your point very clear.

Offcourse i also enjoy the benefits of convention over configuration.
and i never intented to "fight" that.  I just didn't realise that
people actually _need_ the id attribute.  (because i never used ajax,
dom,...)


--~--~-~--~~~---~--~~
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: Html helper emits id attribute that i don't want

2006-09-18 Thread John Zimmerman
Related to how the htmlHelper outputs tags, I just read a blurb about the tags.ini file at http://www.avatarfinancial.com
/pages/cake/Here is the relevant infoCustomizing HTML generated by the Helper  
I needed to change the default  generated when I called $html->selectTag() to say something like "Please Select" rather than an empty space (default). I also wanted radio buttons to have labels so the user doesn't have to click exactly on the radio button itself but can instead click anywhere on the text associated with it. 
Create the file /app/config/tags.ini.php and add the following:; Tag template for a input type='radio' tag.
radio = "
; Tag template for an empty select option tag.
selectempty = "-- Please Select --"You can get a full list of available tags in /cake/config/tags.ini.php. I wouldn't recommend modifying that file, however, because you could lose your changes when you upgrade CakePHP.
So using this configuration file, you can change the convention and omit the id tag. 

--~--~-~--~~~---~--~~
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: Html helper emits id attribute that i don't want

2006-09-18 Thread [EMAIL PROTECTED]

Chris that is so funny that people fight something that would make over
90% of their programming lives MUCH easier.  And for the 10% that you
have to figure out how to make it do it the CakePHP way it would still
be hard programming it the conventional way of configuration.  It is
just that by that time you are used to configuring everything so why
not configure the 10% as well.

CakePHP takes all that away and lets you JUST configure for the special
cases.  And isn't it nice that they made it with classes that you can
extend the functionality and wrap your own code around it?  How
awesome!!!


--~--~-~--~~~---~--~~
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: Html helper emits id attribute that i don't want

2006-09-18 Thread John Zimmerman
On 9/18/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
and what's wrong with just not outputting an id attribute unlessspecified?(like is the usual approach for attributes, you have to specify them ifyou want them)Cake is not the "usual approach".  That is what makes it useful.
There is nothing stopping your from creating your form without
the use of the html helper to omit the id, or as suggested earlier in
the thread, wrapping the html helper in your custom helper.Not
including the id by default would cause people to have to write more
code/configuration in other situations that differ from your "special
case".
Special cases are treated as special cases for a reason.Please
do not take shots at the work being done (for free in fact).  Calling
it stupid does not help.  There is a lot of intelligent design work
that has been done with Cake and chances are if it works one way there
is a good reason for it.  Ask for an explanation or help with a solution instead.  If
there is a bug it will be taken care of promptly if you submit it to
trac. 

--~--~-~--~~~---~--~~
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: Html helper emits id attribute that i don't want

2006-09-18 Thread Chris Hartjes

On 9/18/06, nate <[EMAIL PROTECTED]> wrote:
> Yes, you're right: the usual, dumb, wasteful approach to coding is that
> you have to explicitly specify every little thing you want your program
> to do.
>
> If that's how you want to write your code, you should not, I repeat
> *not* use CakePHP.  CakePHP does things like automatically generate DOM
> ID's for form inputs, because 99.9% of the time, that's exactly what I
> want it to do, so I'd rather it just do it, as opposed to me having to
> tell it to do it.
>
> That's called "convention over configuration".  If you *do not* want it
> to follow this default behavior (a.k.a. "convention"), you can
> *explicitly specify* something else.  Like, for example, a custom DOM
> ID.

During my presentation on Thursday at php|works I talked about
convention over configuration and I fielded a lot of questions from
people about why convention over configuration is good, and the
opinion of a lot of developers seemed to be, well, they wanted to
waste lots of time configuring everything and couldn't understand how
Cake (or Rails for that matter) would be any good if there weren't all
sorts of configuration files to tweak.

/me throws his hands up in the air

Me, I'm lazy and would rather have people smarter than me come up with
solutions that I can work with so I can get back to my life.


-- 
Chris Hartjes

"The greatest inefficiencies come from solving problems you will never have."
-- Rasmus Lerdorf

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
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: Html helper emits id attribute that i don't want

2006-09-18 Thread Sohei Okamoto
Sorry, I accidentally sent in the middle.But anyway, do some checking on attributes and preg_replace the output from the Html helper.Would that be a bad practice, or fine approach in Cake?Sohei

--~--~-~--~~~---~--~~
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: Html helper emits id attribute that i don't want

2006-09-18 Thread Sohei Okamoto
[EMAIL PROTECTED] If it is really causing some problem or bothers you, but you still want to use Html helper,why not write a simple wrapper helper that strip out id attribute when you don't specify?
class HtmlwrapperHelper extends Helper {    var $helpers = Array("Html");        function input($fieldName, $htmlAttributes = null, $return = false)    {    }

--~--~-~--~~~---~--~~
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: Html helper emits id attribute that i don't want

2006-09-18 Thread nate

[EMAIL PROTECTED] wrote:
> and what's wrong with just not outputting an id attribute unless
> specified?
> (like is the usual approach for attributes, you have to specify them if
> you want them)

Yes, you're right: the usual, dumb, wasteful approach to coding is that
you have to explicitly specify every little thing you want your program
to do.

If that's how you want to write your code, you should not, I repeat
*not* use CakePHP.  CakePHP does things like automatically generate DOM
ID's for form inputs, because 99.9% of the time, that's exactly what I
want it to do, so I'd rather it just do it, as opposed to me having to
tell it to do it.

That's called "convention over configuration".  If you *do not* want it
to follow this default behavior (a.k.a. "convention"), you can
*explicitly specify* something else.  Like, for example, a custom DOM
ID.


--~--~-~--~~~---~--~~
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: Html helper emits id attribute that i don't want

2006-09-18 Thread [EMAIL PROTECTED]

It is auto outputting to aid in javascript and AJAX.  Which is a little
hiccup in this stage until 1.2 is releasing with the multiple form
elements for a single field and auto id.

For now you could modify the HTML helper yourself to not do the auto
id.  That is the best suggestion I can give.  Probably something more
elegant, but that does what you need until 1.2 is released.  I
personally love that the framework has taken the turn to closely start
integrating AJAX and Web2.0 tiny helpers like making ids nice and
pretty for us automatically.

I would like to see the Event.Selector code make its way into Cake 1.2
for even prettier degrading.  Also, which Event.Selector and the rules
it would be possible for an end user with problems to switch off AJAX
rather quickly since if the Event.Selector never starts up neither does
AJAX.  Isn't that nice!??!?!

http://encytemedia.com/event-selectors/


--~--~-~--~~~---~--~~
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: Html helper emits id attribute that i don't want

2006-09-18 Thread [EMAIL PROTECTED]

and what's wrong with just not outputting an id attribute unless
specified?
(like is the usual approach for attributes, you have to specify them if
you want them)


--~--~-~--~~~---~--~~
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: Html helper emits id attribute that i don't want

2006-09-18 Thread nate

Currently, the helpers do not support multiple form elements for a
single field.  We're working on a solution for this in Cake 1.2.


--~--~-~--~~~---~--~~
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: Html helper emits id attribute that i don't want

2006-09-18 Thread [EMAIL PROTECTED]

i've looked in the sourcecode of htmlhelper. apparently if you didn't
set an id yourself, the helper will always automatically set the id

setting id to null will trigger the behaviour above, setting id to ''
sets id to '' so we don't want that either :'(

this really isn't fun, because i have several forms of the same type on
1 page. (eg many newsitems each with a reply-form) and thus, i have
many elements with the same id in my xhtml code.  if i don't want this,
i have to type the html code manually instead of using the html
helper.. that's a bit a stupid solution imo


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---