Re: Html link not changing url location

2012-09-28 Thread Léo Willian Kölln
Remember, you don´t need to use Router::url(array()). Pass only the array().

Léo Willian Kölln


On Fri, Sep 28, 2012 at 5:37 PM, arron w...@wwisinc.com wrote:


 I just tried this, with a little work I think i can get this to work.
 Thanks
 ?php echo $this-Html-link($datas['Model']['filed'],
 Router::url(array('controller' = 'controller', 'action' = 'view', 5)))?


 On Friday, September 28, 2012 12:38:52 PM UTC-7, Léo Willian Kölln wrote:

 Why not use Routing Array on the Html::link() ?
 http://book.cakephp.org/2.0/**en/appendices/glossary.html#**
 term-routing-arrayhttp://book.cakephp.org/2.0/en/appendices/glossary.html#term-routing-array
 http://book.cakephp.org/2.0/**en/core-libraries/helpers/**
 html.html#HtmlHelper::linkhttp://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#HtmlHelper::link

 Léo Willian Kölln


 On Tue, Sep 25, 2012 at 2:28 PM, arron w...@wwisinc.com wrote:

  I have configured routes.php so i can have pretty urls

 it works when i do this
 tda href=/?php echo $examples['model']['**somename'];??php
 echo $examples['somemodel']['**slug'];?/a/td

 but I am trying to use cakes way for generating links

 $this-Html-link($examples['**model']['somename'],
 '/controllername/slug/' + $examples['model']['slug']);

 when I use  $this-Html- link the url location doesn't change.



 The url name is different
 but the hyper link doesnt change and is stuck on the first result


 a href =”/example1”example1 /a
 a href =”/example1 ”example2 /a
 a href =”/example1 ”example3 /a
 a href =”/example1”example4 /a


 instead of

 a href =”/example1”example1 /a
 a href =”/example2”example2 /a
 a href =”/example3”example3 /a



 //router.php
 Router::connect(

 /example/:slug,
 array('controller' = 'somecontrollername', 'action' = 'view'),
array(

 'name'='[-A-Z0-9]+',

'pass' = array('slug')



   )

 );
  Router::connectNamed(
 array('/example/' = array('action' = 'view', 'controller' =
 'somecontrollername')),
 array('default' = true, 'greedy' = true)
 );



 //'view.ctp

 ?php
 foreach ($example as $examples): ?

 ?php echo
 $this-Html-link($examples['**model']['somename'],
 '/controllername/slug/' + $examples['model']['slug']);
 ?

 result

 a href =”/example1”example1 /a
 a href =”/example1 ”example2 /a
 a href =”/example1 ”example3 /a
 a href =”/example1”example4 /a


 instead of

 a href =”/example1”example1 /a
 a href =”/example2”example2 /a
 a href =”/example3”example3 /a




 any help would be great

 --
 Like Us on FacekBook 
 https://www.facebook.com/**CakePHPhttps://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 post to this group, send email to cake...@googlegroups.com.
 To unsubscribe from this group, send email to cake-php+u...@**
 googlegroups.com.

 Visit this group at 
 http://groups.google.com/**group/cake-php?hl=enhttp://groups.google.com/group/cake-php?hl=en
 .




  --
 Like Us on FacekBook 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 post to this group, send email to cake-php@googlegroups.com.
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com.
 Visit this group at http://groups.google.com/group/cake-php?hl=en.




-- 
Like Us on FacekBook 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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: DetailsViewHelper (sort of)

2012-09-20 Thread Léo Willian Kölln
Yes, the column name (label).

And no, i don't need to provide it on the FormHelper (necessarily).
I will use the method schema, but to implement a separate centralized label
definition on the model (o thing that i think should already be on the
Framework (suggestion)).

Thanks guys.

Léo Willian Kölln


On Thu, Sep 20, 2012 at 6:54 PM, lowpass zijn.digi...@gmail.com wrote:

 What do you mean by manually? The point of writing it like that is
 that it will display the new value if you change it in the DB.

 Or are you referring to the column name? But you need to provide that
 to FormHelper anyway.

 I don't understand what problem you're trying to fix but there is the
 Model::schema() method. Perhaps that will help with whatever you're
 trying to do.

 On Wed, Sep 19, 2012 at 3:59 PM, Léo Willian Kölln leoko...@gmail.com
 wrote:
  Yes, What i´m doing is this, but this is what i want to avoid. As you
 see,
  you need to manually write the label. What if it changes? If it was
 not a
  problem, FormHelper would not implement a solution for this (label).
 
  In my helper implementation i´m already using the formHelper label method
  implementation (almost full copy and paste). What i´m arguing is that a
  method for retrieving the Label text should be in other place, and the
  formHelper::label() method should use it.
 
  Léo Willian Kölln
 
 
 
  On Wed, Sep 19, 2012 at 2:28 PM, Amit a...@amitvaria.com wrote:
 
  Not entirely sure what you're looking for here. Regarding a simple way
 to
  to output data from the model, it seems simple enough to do:
 
  pField: ?php echo $model['Model']['field']; ?/p
 
  If you're looking for how FormHelper-label() formats the field name,
 you
  could reimplement the label function -
  http://api20.cakephp.org/view_source/form-helper#line-782
 
  On Wednesday, September 19, 2012 11:06:35 AM UTC-5, Léo Willian Kölln
  wrote:
 
  As i´m implementing a CRUD i was trying to make a Helper to make the
  rendering of a Details screen more easy.
 
  The question is, If there is a FormHelper that i can use to help me
  render labels and fields, why does not exists a Helper to output simple
  (direct) data from a Model?
 
  I ask this because as i was trying to implement a Helper like this, one
  of the things is to determine the Label (as in a form, but no label
 tag),
  and there is no isolated implementation to get this info, only on the
  FormHelper-label(). In my opinion the implementation to get the
 text of a
  label should go on other place (maybe on the Helper base class?) as
 this is
  a separated concept.
 
  I´m wrong? There is other way to get this data?
 
  Léo Willian Kölln
 
  --
  Like Us on FacekBook 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 post to this group, send email to cake-php@googlegroups.com.
  To unsubscribe from this group, send email to
  cake-php+unsubscr...@googlegroups.com.
  Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 
 
 
  --
  Like Us on FacekBook 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 post to this group, send email to cake-php@googlegroups.com.
  To unsubscribe from this group, send email to
  cake-php+unsubscr...@googlegroups.com.
  Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

 --
 Like Us on FacekBook 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 post to this group, send email to cake-php@googlegroups.com.
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com.
 Visit this group at http://groups.google.com/group/cake-php?hl=en.




-- 
Like Us on FacekBook 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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: DetailsViewHelper (sort of)

2012-09-20 Thread Léo Willian Kölln
What i'm talking about is $this-Form-input(you_name_it) will generate a
labelYou Name It/label and one input.

There is no generic method so i can generate this label text based on the
column name (except of the FormHelper).

A helper to output this type of data would be nice (a label and the data
based on the column of a model). Rebember, i'm not talking about a form
here, i want same data, different outputting.

I have an idea how to do it, i'm just saying a stock one may be helpful to
other people and save some work...

Léo Willian Kölln


On Fri, Sep 21, 2012 at 12:24 AM, lowpass zijn.digi...@gmail.com wrote:

 How do you not provide the column name (or alias)?

 On Thu, Sep 20, 2012 at 11:00 PM, Léo Willian Kölln leoko...@gmail.com
 wrote:
  Yes, the column name (label).
 
  And no, i don't need to provide it on the FormHelper (necessarily).
  I will use the method schema, but to implement a separate centralized
 label
  definition on the model (o thing that i think should already be on the
  Framework (suggestion)).
 
  Thanks guys.
 
  Léo Willian Kölln
 
 
 
  On Thu, Sep 20, 2012 at 6:54 PM, lowpass zijn.digi...@gmail.com wrote:
 
  What do you mean by manually? The point of writing it like that is
  that it will display the new value if you change it in the DB.
 
  Or are you referring to the column name? But you need to provide that
  to FormHelper anyway.
 
  I don't understand what problem you're trying to fix but there is the
  Model::schema() method. Perhaps that will help with whatever you're
  trying to do.
 
  On Wed, Sep 19, 2012 at 3:59 PM, Léo Willian Kölln leoko...@gmail.com
  wrote:
   Yes, What i´m doing is this, but this is what i want to avoid. As you
   see,
   you need to manually write the label. What if it changes? If it was
   not a
   problem, FormHelper would not implement a solution for this (label).
  
   In my helper implementation i´m already using the formHelper label
   method
   implementation (almost full copy and paste). What i´m arguing is that
 a
   method for retrieving the Label text should be in other place, and the
   formHelper::label() method should use it.
  
   Léo Willian Kölln
  
  
  
   On Wed, Sep 19, 2012 at 2:28 PM, Amit a...@amitvaria.com wrote:
  
   Not entirely sure what you're looking for here. Regarding a simple
 way
   to
   to output data from the model, it seems simple enough to do:
  
   pField: ?php echo $model['Model']['field']; ?/p
  
   If you're looking for how FormHelper-label() formats the field name,
   you
   could reimplement the label function -
   http://api20.cakephp.org/view_source/form-helper#line-782
  
   On Wednesday, September 19, 2012 11:06:35 AM UTC-5, Léo Willian Kölln
   wrote:
  
   As i´m implementing a CRUD i was trying to make a Helper to make the
   rendering of a Details screen more easy.
  
   The question is, If there is a FormHelper that i can use to help me
   render labels and fields, why does not exists a Helper to output
   simple
   (direct) data from a Model?
  
   I ask this because as i was trying to implement a Helper like this,
   one
   of the things is to determine the Label (as in a form, but no
 label
   tag),
   and there is no isolated implementation to get this info, only on
 the
   FormHelper-label(). In my opinion the implementation to get the
   text of a
   label should go on other place (maybe on the Helper base class?) as
   this is
   a separated concept.
  
   I´m wrong? There is other way to get this data?
  
   Léo Willian Kölln
  
   --
   Like Us on FacekBook 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 post to this group, send email to cake-php@googlegroups.com.
   To unsubscribe from this group, send email to
   cake-php+unsubscr...@googlegroups.com.
   Visit this group at http://groups.google.com/group/cake-php?hl=en.
  
  
  
  
   --
   Like Us on FacekBook 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 post to this group, send email to cake-php@googlegroups.com.
   To unsubscribe from this group, send email to
   cake-php+unsubscr...@googlegroups.com.
   Visit this group at http://groups.google.com/group/cake-php?hl=en.
  
  
 
  --
  Like Us on FacekBook 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 post to this group, send email to cake-php@googlegroups.com.
  To unsubscribe from this group, send email to
  cake-php+unsubscr...@googlegroups.com.
  Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 
 
  --
  Like Us on FacekBook https://www.facebook.com/CakePHP
  Find us on Twitter http://twitter.com/CakePHP

DetailsViewHelper (sort of)

2012-09-19 Thread Léo Willian Kölln
As i´m implementing a CRUD i was trying to make a Helper to make the
rendering of a Details screen more easy.

The question is, If there is a FormHelper that i can use to help me render
labels and fields, why does not exists a Helper to output simple (direct)
data from a Model?

I ask this because as i was trying to implement a Helper like this, one of
the things is to determine the Label (as in a form, but no label tag),
and there is no isolated implementation to get this info, only on the
FormHelper-label(). In my opinion the implementation to get the text of
a label should go on other place (maybe on the Helper base class?) as this
is a separated concept.

I´m wrong? There is other way to get this data?

Léo Willian Kölln

-- 
Like Us on FacekBook 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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: DetailsViewHelper (sort of)

2012-09-19 Thread Léo Willian Kölln
Yes, What i´m doing is this, but this is what i want to avoid. As you see,
you need to manually write the label. What if it changes? If it was not a
problem, FormHelper would not implement a solution for this (label).

In my helper implementation i´m already using the formHelper label method
implementation (almost full copy and paste). What i´m arguing is that a
method for retrieving the Label text should be in other place, and the
formHelper::label() method should use it.

Léo Willian Kölln


On Wed, Sep 19, 2012 at 2:28 PM, Amit a...@amitvaria.com wrote:

 Not entirely sure what you're looking for here. Regarding a simple way to
 to output data from the model, it seems simple enough to do:

 pField: ?php echo $model['Model']['field']; ?/p

 If you're looking for how FormHelper-label() formats the field name, you
 could reimplement the label function -
 http://api20.cakephp.org/view_source/form-helper#line-782

 On Wednesday, September 19, 2012 11:06:35 AM UTC-5, Léo Willian Kölln
 wrote:

 As i´m implementing a CRUD i was trying to make a Helper to make the
 rendering of a Details screen more easy.

 The question is, If there is a FormHelper that i can use to help me
 render labels and fields, why does not exists a Helper to output simple
 (direct) data from a Model?

 I ask this because as i was trying to implement a Helper like this, one
 of the things is to determine the Label (as in a form, but no label tag),
 and there is no isolated implementation to get this info, only on the
 FormHelper-label(). In my opinion the implementation to get the text of
 a label should go on other place (maybe on the Helper base class?) as this
 is a separated concept.

 I´m wrong? There is other way to get this data?

 Léo Willian Kölln

  --
 Like Us on FacekBook 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 post to this group, send email to cake-php@googlegroups.com.
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com.
 Visit this group at http://groups.google.com/group/cake-php?hl=en.




-- 
Like Us on FacekBook 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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Error rendering, is it the intended functionality?

2012-09-16 Thread Léo Willian Kölln
Why there is some DB interaction during the View rendering? You dont
need to do any query explicitly on the View file, if you are calling
a method that does some DB interaction you are doing a Query during
the View Context.
If you need some data that comes from model (doesn't matter if it is
from DB or not), do it on the controller, setting variables to output
them on the View.

Can someone confirm my conclusion?


Léo Willian Kölln


On Sun, Sep 16, 2012 at 7:19 AM, Mohammad Naghavi moham...@gmail.com wrote:
 Hi,
 I do no query from inside the View, I just call this:
 $this-Form-create();
 inside my view. the problem is that every thing inside view before this line
 comes as a part of the exception handling output.
 what I think is that because I don't call any db or model related actions
 inside the controller, the exception is thrown and caught at the point that
 form creation is triggered, where the cake tries to connect to db.

 anyway I managed to solve my problem using a custom error controller. but I
 think it is good for core developers to know the situation.

 regards,
 MN



 On Fri, Sep 14, 2012 at 7:57 PM, lowpass zijn.digi...@gmail.com wrote:

 Are you making DB queries from within the View? You should be doing so
 from the model or controller. Then, once the controller has all the
 data it requires, it passes it to View to be rendered.

 On Fri, Sep 14, 2012 at 4:43 AM, Mohammad Naghavi moham...@gmail.com
 wrote:
  Hi,
  I'm dealing with an action of a controller, in which no db interaction
  is
  required until it comes to rendering the view. inside the view, again
  first
  half of the view doesn't need any db interactions until a form creation
  is
  started somewhere in the middle. I'm preparing my app for production
  environment so I came to the point to make it clean. there I tested the
  situation in which DB is shut down and pointed the browser to that
  action,
  what I expected was a single internal error page, but what I got was a
  half
  rendered view, which was accompanied with the rendered error layout.
  something like following:
 
  h4 class=warning
  some message here
  /h4
 
 
  !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
  http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
  html xmlns=http://www.w3.org/1999/xhtml;
  head
meta http-equiv=Content-Type content=text/html; charset=utf-8
  /title
CakePHP: the rapid development php framework:
Errors  /title
link href=/itbs/favicon.ico type=image/x-icon rel=icon
  /link
  href=/itbs/favicon.ico type=image/x-icon rel=shortcut icon /link
  rel=stylesheet type=text/css href=/itbs/css/cake.generic.css
  //head
  body
div id=container
 
  ...
 
 
  now my question is that how to remove this first part of half rendered
  view?
  I tried to set $this-response-body(' '); on beforeRender of the
  appController for the case that controller-name is CakeError but it
  didn't
  work, any other suggestions?
 
  regards,
  MN
 
  --
  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.
  Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 

 --
 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.
 Visit this group at http://groups.google.com/group/cake-php?hl=en-US.



 --
 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.
 Visit this group at http://groups.google.com/group/cake-php?hl=en-US.



-- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.