Re: HtmlHelper::div close tag?

2012-02-21 Thread Miles J
The only real use for generating HTML with the helper is when you are
packaging markup from within a helper. Just manually write it in the
view.

On Feb 21, 7:20 am, Jeremy Burns | Class Outfit
 wrote:
> I went down the whole Html->tag route once and then methodically went through 
> and unpicked it; it just didn't make sense in 99.9% of all instances.
>
> Jeremy Burns
> Class Outfit
>
> http://www.classoutfit.com
>
> On 21 Feb 2012, at 15:16:09, jeremyharris wrote:
>
>
>
>
>
>
>
> > The reason is because $text is empty. HtmlHelper::div uses HtmlHelper::tag 
> > which documents that it will only print the starting tag if no text is 
> > within the tag. I personally don't like this behavior. That's why you'll 
> > see things like this in baked code
>
> > echo $this->Html->tag('div', $post['Post']['name'].' ');
>
> > A   is appended just in case the value is empty, so to make sure it 
> > includes a closing tag. So at the very least you'll need something in there.
>
> > --
> > Our newest site for the community: CakePHP Video 
> > Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd 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 
> > athttp://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: HtmlHelper::div close tag?

2012-02-21 Thread Jeremy Burns | Class Outfit
I went down the whole Html->tag route once and then methodically went through 
and unpicked it; it just didn't make sense in 99.9% of all instances.


Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 21 Feb 2012, at 15:16:09, jeremyharris wrote:

> The reason is because $text is empty. HtmlHelper::div uses HtmlHelper::tag 
> which documents that it will only print the starting tag if no text is within 
> the tag. I personally don't like this behavior. That's why you'll see things 
> like this in baked code
> 
> echo $this->Html->tag('div', $post['Post']['name'].' ');
> 
> A   is appended just in case the value is empty, so to make sure it 
> includes a closing tag. So at the very least you'll need something in there.
> 
> 
> -- 
> 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

-- 
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: HtmlHelper::div close tag?

2012-02-21 Thread jeremyharris
The reason is because $text is empty. HtmlHelper::div uses HtmlHelper::tag 
which documents that it will only print the starting tag if no text is 
within the tag. I personally don't like this behavior. That's why you'll 
see things like this in baked code

echo $this->Html->tag('div', $post['Post']['name'].' ');

A   is appended just in case the value is empty, so to make sure it 
includes a closing tag. So at the very least you'll need something in there.

-- 
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: HtmlHelper::div close tag?

2012-02-21 Thread Tilen Majerle
i'm using like this

for start tag
$this->Html->useTag('tagstart', 'div', array(html options here));

for end tag
$this->Html->useTag('tagend', 'div');

--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2012/2/21 Perry 

> thanks for the reply, I have many elements to be wrapped, and I'm using
> the HtmlHelper to generate these nested elements too, so I cant' pass these
> elements as the second parameter
>
> maybe I should write the layout directly
>
>
> On Tue, Feb 21, 2012 at 2:36 PM, Greg Skerman  wrote:
>
>> I always find leaving the markup in its native language is beneficial,
>> except in cases where cake's pathing becomes an issue (image, anchors
>> etc)...
>>
>> I'd go and write foo personally, but thats just me.
>>
>> however, from the documentation:
>>
>> HtmlHelper::div(*string $class*, *string $text*, *array $options*)
>> Parameters:
>>
>>- *$class* (*string*) – The classname for the div.
>>- *$text* (*string*) – The content inside the div.
>>- *$options* (*array*) – An array of *html 
>> attributes*
>>.
>>
>>   Used for creating div-wrapped sections of markup. The first parameter
>> specifies a CSS class, and the second is used to supply the text to be
>> wrapped by div tags. If the last parameter has been set to true, $text will
>> be printed HTML-escaped.
>>
>> If no text is specified, only an opening div tag is returned.:
>>
>> Html->div('error', 'Please enter your credit card number.');
>> // OutputPlease enter your credit card number.
>>
>>
>>
>> i.e. its going to wrap it up in a closing div for youbut you need to
>> pass a class to it as the first parameter... $this->Html->div('someClass',
>> 'foo'); should do the trick.
>>
>>
>>
>>
>> On Tue, Feb 21, 2012 at 4:13 PM, Perry  wrote:
>>
>>> Hi guys, I want to wrap some elements in a div, and I'm using
>>>
>>> $this->Html->div('foo')
>>>
>>>
>>> to generate the starting div tag, but I can't find a method to generate
>>> the closing tag
>>>
>>> how can I use the HtmlHelper to do this? I think write the ''
>>>  directly is ugly...
>>>
>>> --
>>> Perry | 彭琪
>>> http://pengqi.me
>>>
>>>  --
>>> 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
>>>
>>
>>  --
>> 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
>>
>
>
>
> --
> Perry | 彭琪
> http://pengqi.me
>
>  --
> 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
>

-- 
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: HtmlHelper::div close tag?

2012-02-20 Thread Perry
thanks for the reply, I have many elements to be wrapped, and I'm using the
HtmlHelper to generate these nested elements too, so I cant' pass these
elements as the second parameter

maybe I should write the layout directly

On Tue, Feb 21, 2012 at 2:36 PM, Greg Skerman  wrote:

> I always find leaving the markup in its native language is beneficial,
> except in cases where cake's pathing becomes an issue (image, anchors
> etc)...
>
> I'd go and write foo personally, but thats just me.
>
> however, from the documentation:
>
> HtmlHelper::div(*string $class*, *string $text*, *array $options*)
> Parameters:
>
>- *$class* (*string*) – The classname for the div.
>- *$text* (*string*) – The content inside the div.
>- *$options* (*array*) – An array of *html 
> attributes*
>.
>
>   Used for creating div-wrapped sections of markup. The first parameter
> specifies a CSS class, and the second is used to supply the text to be
> wrapped by div tags. If the last parameter has been set to true, $text will
> be printed HTML-escaped.
>
> If no text is specified, only an opening div tag is returned.:
>
> Html->div('error', 'Please enter your credit card number.');
> // OutputPlease enter your credit card number.
>
> i.e. its going to wrap it up in a closing div for youbut you need to
> pass a class to it as the first parameter... $this->Html->div('someClass',
> 'foo'); should do the trick.
>
>
>
>
> On Tue, Feb 21, 2012 at 4:13 PM, Perry  wrote:
>
>> Hi guys, I want to wrap some elements in a div, and I'm using
>>
>> $this->Html->div('foo')
>>
>>
>> to generate the starting div tag, but I can't find a method to generate
>> the closing tag
>>
>> how can I use the HtmlHelper to do this? I think write the ''
>>  directly is ugly...
>>
>> --
>> Perry | 彭琪
>> http://pengqi.me
>>
>>  --
>> 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
>>
>
>  --
> 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
>



-- 
Perry | 彭琪
http://pengqi.me

-- 
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: HtmlHelper::div close tag?

2012-02-20 Thread Greg Skerman
I always find leaving the markup in its native language is beneficial,
except in cases where cake's pathing becomes an issue (image, anchors
etc)...

I'd go and write foo personally, but thats just me.

however, from the documentation:

HtmlHelper::div(*string $class*, *string $text*, *array $options*)
Parameters:

   - *$class* (*string*) – The classname for the div.
   - *$text* (*string*) – The content inside the div.
   - *$options* (*array*) – An array of *html
attributes*
   .

  Used for creating div-wrapped sections of markup. The first parameter
specifies a CSS class, and the second is used to supply the text to be
wrapped by div tags. If the last parameter has been set to true, $text will
be printed HTML-escaped.

If no text is specified, only an opening div tag is returned.:

Html->div('error', 'Please enter your credit card number.');
// OutputPlease enter your credit card number.

i.e. its going to wrap it up in a closing div for youbut you need to
pass a class to it as the first parameter... $this->Html->div('someClass',
'foo'); should do the trick.




On Tue, Feb 21, 2012 at 4:13 PM, Perry  wrote:

> Hi guys, I want to wrap some elements in a div, and I'm using
>
> $this->Html->div('foo')
>
>
> to generate the starting div tag, but I can't find a method to generate
> the closing tag
>
> how can I use the HtmlHelper to do this? I think write the ''
>  directly is ugly...
>
> --
> Perry | 彭琪
> http://pengqi.me
>
>  --
> 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
>

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


HtmlHelper::div close tag?

2012-02-20 Thread Perry
Hi guys, I want to wrap some elements in a div, and I'm using

$this->Html->div('foo')


to generate the starting div tag, but I can't find a method to generate the
closing tag

how can I use the HtmlHelper to do this? I think write the ''
 directly is ugly...

-- 
Perry | 彭琪
http://pengqi.me

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