Convert native PHP class into cakePHP component

2011-09-05 Thread elogic
Hi All,

I am only new to cakePHP and am learning slowly (but loving it). I
have been given a pre-built class and some basic instructions on how
to use it from our SMS provider (it works very well and easily with
native PHP).

I need to convert the class into something that I can easily use
within cakePHP sites. Am I right in assuming I want to convert it into
a component? If not what would you suggest?

Are there any tutorials around that might help me complete my task? I
presume it shouldn't be too hard at all once I know what I am doing.

Thanks

-- 
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: How to retrieve data which is posted to secure page

2011-09-05 Thread Greg Skerman
Assuming you are using Auth, with all the defaults...

when the user goes to /controller/secureform, assuming its not in the
allowed list, the user will be automatically redirected to the login form...
on successful login it will redirect them back to the secure form with the
auth session filled in. You can of course do further checks if only a
specific class of user should access the secure form.

Much nicer than having somebody fill in a form, and then force them to
login.

If you absolutely must do it this way, have the form action on the secure
form store the data in a session, redirect to the login form, and on
successful login process the data from the session instead of from
$this->data


On Mon, Sep 5, 2011 at 9:10 PM, WebbedIT  wrote:

> beinng shown a form that you fill in only to be presented with a "you
> must login to submit this form" message.  H, no thanks.
>
> Also if the data is to eventually be secure (i.e. encrypted) how is it
> secure when sent from http?!?
>
> @phpMagpie
>
> On Sep 2, 10:50 am, euromark  wrote:
> > you should as a guideline always post a form to itself.
> > therefore the same action can work with the posted data and afterwards
> > redirect to the secure page
> >
> > On 1 Sep., 22:27, vinay  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Hi,
> > > Looking for help on implementing requirement where user will see a
> > > form even without logging in to the website. Once user submit the form
> > > the data is posted to secured page, that' s why user is redirected to
> > > login page.
> > > How do I get the data posted by user because based on that I need to
> > > show him next step once he logged in.
> >
> > > THanks,
> > > Vinay
>
> --
> 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: Facebook & Session Component

2011-09-05 Thread Ryan Schmidt

On Sep 1, 2011, at 18:49, gurelkaynak wrote:

> My urls on google looked like this: mysite.com/ and on my server
> I had a redirect from mysite.com to www.mysite.com. And since the my logged
> in users cookie's domain was only available for www.mysite.com when someone
> would click a link on google the session was getting created again or
> something. So I changed to cookie's domain to .mysite.com and it all worked
> fine. 

That solution is an anti-pattern.

http://developer.yahoo.com/performance/rules.html#cookie_free


-- 
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: Using GET not POST returns empty $this->data

2011-09-05 Thread Ryan Schmidt

On Sep 5, 2011, at 05:55, WebbedIT wrote:

> It is a VERY bad idea to accept data via GET that you are going to
> write into your database.  Please do not do it, you should only accept
> POST data

Why, by the way? It is no more difficult for a user (web browser, JavaScript, 
curl, etc.) to send POST data than it is to send GET data. Either you trust the 
user to supply data to your application or you don't.


-- 
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: CakePHP without naming convention. is it possible?

2011-09-05 Thread Greg Skerman
I told you how to do it :) its not impossible, you just risk it becoming an
unmaintainable mess.

There are many tables I use which come from other systems/are static dumps
of tables out of systems i need to use as reference data but don't want to
muck up the table definitions etc - and I routinely tell cake "this is this,
that is that"...and all is good

Its just something that needs to be dealt with carefully - if you have
hundreds of tables and nothing else depends on them, and you have the
time/budget to do it, it may be worth altering the tables to be more cake
friendlybut if not, just configure your models and document everything
carefully so the next developer who has to come along knows what it is
you've done to make it work.


On Mon, Sep 5, 2011 at 5:20 PM, Cruisine  wrote:

> to be honest,i don't really want this happen.but what am i supposed to
> do?i cant build new database since the current database have lots of
> datas inside. after i read ur reply i started to think like that as
> well.my work will be hard later. i have to define lots of things on
> the model and i don't have an idea about the unpreddicted issues which
> will follow later.
>
> do you have any idea to solve this problem?
>
>
> On Sep 5, 10:39 am, Greg Skerman  wrote:
> > http://book.cakephp.org/view/1057/Model-Attributesis a good place to
> start.
> >
> > you can configure in most circumstances cake to talk to any old database
> -
> > you just end up losing some of the magic and writing more code as a
> result.
> >
> > for a model which does not comply with the convention you will at least
> need
> > to:
> >
> > 1) define the table name ($useTable)
> > 2) define the primary key ($primaryKey)
> > 3) define the display name ($displayName)
> >
> > you'll also need to provide more verbose settings in the model
> associations
> > in order to get them to play nice...
> >
> > On Mon, Sep 5, 2011 at 9:34 AM, Cruisine  wrote:
> > > hi guys, i need to know something important about naming convention.
> > > yeah, i've been using naming convention while developing all my app
> > > all the time. but recently a problem appeared. let say  i've got a
> > > project to re-developing an app ( from non-cakephp to cakephp) which
> > > already had a database. and of course since the app hadn't been built
> > > by cakephp the database also didn't follow the cakephp naming
> > > convention rules.
> > > the question i have is, how do i make an application using cakephp
> > > with that database?is it still possible to  built a cakephp project
> > > without following naming convention rules?
> >
> > > need ur help soon.thank you.
> >
> > > --
> > > Our newest site for the community: CakePHP Video Tutorials
> > >http://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
>

-- 
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: cakephp 2 app deployed on a subdomain

2011-09-05 Thread #2Will
ok, thank you for replying.

I think what they are talking about in that is when you want to be
able to use different subdomains for different links etc?

That shouldn't be necessary just to deploy the whole app to a
subdomain should it?  or am i reading that wrong?

Thanks

will

On Sep 5, 9:59 pm, WebbedIT  wrote:
> Cake 2.0 beings some canges to the router to help with subdomains that
> were touched on at 
> CakeFest:http://book2.cakephp.org/en/appendices/new-features-in-cakephp-2-0.ht...
>
> HTT, Paul
> @phpMagpie
>
> On Sep 5, 1:38 am, "#2Will"  wrote:
>
>
>
>
>
>
>
> > comparing debug($_SERVER) between local and stage sites
>
> > local:      [PHP_SELF] => /app/webroot/index.php/people/login
> > stage:    [PHP_SELF] => /app/webroot/people/login
>
> > This seems like a likely to be relevent, but what could be causing
> > it?  I think i have all my htaccess files present.
>
> > Looking at other apps ive deployed to subdomain-stage , the PHP_SELF
> > is /app/webroot/index.php  without the /controller/action   - but
> > thats 1.3 apps.
>
> > hmm.  more digging.
>
> > On Sep 5, 10:11 am, "#2Will"  wrote:
>
> > > just running some debug statements looking at paths:
>
> > > debug(ROOT);
> > > debug(WWW_ROOT);
> > > debug(WEBROOT_DIR);
> > > debug(APP_DIR);
> > > debug(APP_PATH);
> > > gives me
>
> > > /home/kindlem1/public_html/elip
> > > /home/kindlem1/public_html/elip/app/webroot/
> > > webroot
> > > app
> > > /home/kindlem1/public_html/elip/app/
>
> > > Which i think looks as expected.
>
> > > On Sep 5, 9:58 am, "#2Will"  wrote:
>
> > > > Sorry, forgot to mention: i'm on 2.0 rc1
>
> > > > On Sep 5, 9:56 am, "#2Will"  wrote:
>
> > > > > Hello
>
> > > > > I have deployed a little app to a subdomain as a stage environment -
> > > > > iv'e done this before with 1.3 apps and not had to do anything special
> > > > > to get it to work. The app works on my localhost
>
> > > > > I'm getting errors where for example the login form now gives error
>
> > > > > Error: The requested address '/app/webroot/people/people/login' was
> > > > > not found on this server
>
> > > > > and if i enable debug in config.php debug kit gives is broken, with
> > > > > files missing because they are pointing to wrong addresses
>
> > > > > eg:  app/webroot/people/debug_kit/js/js_debug_toolbar.js
>
> > > > > Is there something special i need to do for cakephp2 apps in
> > > > > subdomains?
>
> > > > > Thanks v much for any help,
>
> > > > > will

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


'Site under maintenance' option

2011-09-05 Thread Xoubaman
I'm trying to implement a system to disable the site temporaly for 
maintenance purposes or whatever. If the site is disabled, only logged users 
can navigate through it, non-logged users are redirected to a "Site under 
maintenance" layout.

Currently (o "As of now"), my approach is to allow a "secret url" that will 
lead to the login form, check in AppController::beforefilter if the current 
url is the allowed one and, if it isn't, set the maintenance layout. Trying 
to figure out how to allow only one url to log in, I came to define it as a 
constant in bootstrap and add the route in config/routes pointing to 
UsersController::login.

It would be nice to save the secret url into the database and change it 
without editing bootstrap.php, though.

Any suggestion?


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


Aw: Re: CakePHP without naming convention. is it possible?

2011-09-05 Thread Jens Dittrich
I do not see any problem in what you describe above. I understand that it is 
comfortable to use the naming conventions whenever you can, but that should 
not stop you from using CakePHP with an existing database that does not care 
about these conventions.
CakePHP follows conventions *over *configuration but that does not mean you 
can't configure. You will probably have to touch all model files manually, 
but wouldn't you do that anyway along your development path?
You can set table names, keys and so on and so forth... you will probably 
have a little slower start, that's all.
If you run into concrete problems you will surely find good answers here!

regards Jens

-- 
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: baking plugins cakephp2

2011-09-05 Thread p r
cake bake model PluginName.ModelName works.



On 5 Sep., 21:10, p r  wrote:
> hello,
>
> i tried to bake a plugin in cakephp 2. the help says i could use
> parameter -p to bake some models like cake bake model -p PluginName.
> but the "bake Model Path" does not changed to /app/Plugin/PluginName
> and also does not use the created Plugin folder.
> Has anybody some experiences to share? that would really appreciated.
> greetings

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


baking plugins cakephp2

2011-09-05 Thread p r
hello,

i tried to bake a plugin in cakephp 2. the help says i could use
parameter -p to bake some models like cake bake model -p PluginName.
but the "bake Model Path" does not changed to /app/Plugin/PluginName
and also does not use the created Plugin folder.
Has anybody some experiences to share? that would really appreciated.
greetings

-- 
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: CakePHP 2.0.0-RC1 Hot and fresh

2011-09-05 Thread Taffarel de Lima
Yeah, finally! I can't wait for the stable version.

2011/9/5 Vitor Pacheco 

> Thanks so much!!
>
> Em Seg 05 Set 2011 11:11:07 BRT, Salines escreveu:
>
>  Thanks!
>>
>> --
>> 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+unsubscribe@**googlegroups.comFor
>>  more options, visit this group at
>> http://groups.google.com/**group/cake-php
>>
>
> --
> *Vitor Pacheco*
> Skype: vitor.pacheco.costa
> Msn: vitor-...@hotmail.com
> Cel.: 71 8626-7909
> Tel.: 71 3378-5778 / 71 3287-3475
>
>
> --
> 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+unsubscribe@**googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/**group/cake-php
>



-- 
*Taffarel de Lima Oliveira (Taffarelo3)*
*
*
*Desenvolvedor Web*

-- 
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: CakePHP 2.0.0-RC1 Hot and fresh

2011-09-05 Thread Vitor Pacheco

Thanks so much!!

Em Seg 05 Set 2011 11:11:07 BRT, Salines escreveu:

Thanks!

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


--
*Vitor Pacheco*
Skype: vitor.pacheco.costa
Msn: vitor-...@hotmail.com
Cel.: 71 8626-7909
Tel.: 71 3378-5778 / 71 3287-3475

--
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: CakePHP 2.0.0-RC1 Hot and fresh

2011-09-05 Thread Salines
Thanks!

-- 
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: CakePHP without naming convention. is it possible?

2011-09-05 Thread Cruisine
@tran cao thai :
umm...yeah changing into another framework is the fastest
solution...but we're working as a teamwork..so to decide changing the
framework is not that easy since the entire team member are used to
have cakephp as their framework to build an application. so as long as
it's not too risky i'll keep using cakephp as the framework.

thats why i need to know whether there are any side-effects if i'm not
following naming convention rules..i need lots of information about
this issue before i really make a decision..

Thanks in advance.

On Sep 5, 8:10 pm, Tran Cao Thai  wrote:
> that is the limitation of the framework, i think. If mapping is too
> difficult and it makes system hard to maintain in the future, maybe changing
> to the other frameworks is a not-too-bad solution (Zend ??? )
>
> On Mon, Sep 5, 2011 at 7:19 PM, Cruisine  wrote:
> > @WebbedIT
> > its up to 100 tables and still being accesed by that application...in
> > fact this application is still running..due to the integration issue
> > with another application which is using PHP as the engine, i need to
> > re-develop the application into PHP. and i considered to use Cakephp
> > as the framework since another application was built by this framework
> > as well.
> > just for info, the old app was built by java and i don't have an
> > authority to build a new database..
>
> > On Sep 5, 6:43 pm, WebbedIT  wrote:
> > > Cruisine,
>
> > > How many tables are we talking about?  Is the old application using
> > > this database still going to be accessing it or will your new one be
> > > the sole point of access?
>
> > > As Greg says, it certainly can be done, but soo much easier to write
> > > an import script and migrate the system to a new database.  May take
> > > some time up front, but will save so much more in the long run.
>
> > > HTH, Paul
> > > @phpMagpie
>
> > > On Sep 5, 8:20 am, Cruisine  wrote:
>
> > > > to be honest,i don't really want this happen.but what am i supposed to
> > > > do?i cant build new database since the current database have lots of
> > > > datas inside. after i read ur reply i started to think like that as
> > > > well.my work will be hard later. i have to define lots of things on
> > > > the model and i don't have an idea about the unpreddicted issues which
> > > > will follow later.
>
> > > > do you have any idea to solve this problem?
>
> > > > On Sep 5, 10:39 am, Greg Skerman  wrote:
>
> > > > >http://book.cakephp.org/view/1057/Model-Attributesisagoodplace to
> > start.
>
> > > > > you can configure in most circumstances cake to talk to any old
> > database -
> > > > > you just end up losing some of the magic and writing more code as a
> > result.
>
> > > > > for a model which does not comply with the convention you will at
> > least need
> > > > > to:
>
> > > > > 1) define the table name ($useTable)
> > > > > 2) define the primary key ($primaryKey)
> > > > > 3) define the display name ($displayName)
>
> > > > > you'll also need to provide more verbose settings in the model
> > associations
> > > > > in order to get them to play nice...
>
> > > > > On Mon, Sep 5, 2011 at 9:34 AM, Cruisine 
> > wrote:
> > > > > > hi guys, i need to know something important about naming
> > convention.
> > > > > > yeah, i've been using naming convention while developing all my app
> > > > > > all the time. but recently a problem appeared. let say  i've got a
> > > > > > project to re-developing an app ( from non-cakephp to cakephp)
> > which
> > > > > > already had a database. and of course since the app hadn't been
> > built
> > > > > > by cakephp the database also didn't follow the cakephp naming
> > > > > > convention rules.
> > > > > > the question i have is, how do i make an application using cakephp
> > > > > > with that database?is it still possible to  built a cakephp project
> > > > > > without following naming convention rules?
>
> > > > > > need ur help soon.thank you.
>
> > > > > > --
> > > > > > Our newest site for the community: CakePHP Video Tutorials
> > > > > >http://tv.cakephp.org
> > > > > > Check out the new CakePHP Questions
> > sitehttp://ask.cakephp.organdhelp
> > > > > > 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 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 question

Re: CakePHP without naming convention. is it possible?

2011-09-05 Thread Tran Cao Thai
that is the limitation of the framework, i think. If mapping is too
difficult and it makes system hard to maintain in the future, maybe changing
to the other frameworks is a not-too-bad solution (Zend ??? )



On Mon, Sep 5, 2011 at 7:19 PM, Cruisine  wrote:

> @WebbedIT
> its up to 100 tables and still being accesed by that application...in
> fact this application is still running..due to the integration issue
> with another application which is using PHP as the engine, i need to
> re-develop the application into PHP. and i considered to use Cakephp
> as the framework since another application was built by this framework
> as well.
> just for info, the old app was built by java and i don't have an
> authority to build a new database..
>
>
> On Sep 5, 6:43 pm, WebbedIT  wrote:
> > Cruisine,
> >
> > How many tables are we talking about?  Is the old application using
> > this database still going to be accessing it or will your new one be
> > the sole point of access?
> >
> > As Greg says, it certainly can be done, but soo much easier to write
> > an import script and migrate the system to a new database.  May take
> > some time up front, but will save so much more in the long run.
> >
> > HTH, Paul
> > @phpMagpie
> >
> > On Sep 5, 8:20 am, Cruisine  wrote:
> >
> > > to be honest,i don't really want this happen.but what am i supposed to
> > > do?i cant build new database since the current database have lots of
> > > datas inside. after i read ur reply i started to think like that as
> > > well.my work will be hard later. i have to define lots of things on
> > > the model and i don't have an idea about the unpreddicted issues which
> > > will follow later.
> >
> > > do you have any idea to solve this problem?
> >
> > > On Sep 5, 10:39 am, Greg Skerman  wrote:
> >
> > > >http://book.cakephp.org/view/1057/Model-Attributesisagood place to
> start.
> >
> > > > you can configure in most circumstances cake to talk to any old
> database -
> > > > you just end up losing some of the magic and writing more code as a
> result.
> >
> > > > for a model which does not comply with the convention you will at
> least need
> > > > to:
> >
> > > > 1) define the table name ($useTable)
> > > > 2) define the primary key ($primaryKey)
> > > > 3) define the display name ($displayName)
> >
> > > > you'll also need to provide more verbose settings in the model
> associations
> > > > in order to get them to play nice...
> >
> > > > On Mon, Sep 5, 2011 at 9:34 AM, Cruisine 
> wrote:
> > > > > hi guys, i need to know something important about naming
> convention.
> > > > > yeah, i've been using naming convention while developing all my app
> > > > > all the time. but recently a problem appeared. let say  i've got a
> > > > > project to re-developing an app ( from non-cakephp to cakephp)
> which
> > > > > already had a database. and of course since the app hadn't been
> built
> > > > > by cakephp the database also didn't follow the cakephp naming
> > > > > convention rules.
> > > > > the question i have is, how do i make an application using cakephp
> > > > > with that database?is it still possible to  built a cakephp project
> > > > > without following naming convention rules?
> >
> > > > > need ur help soon.thank you.
> >
> > > > > --
> > > > > Our newest site for the community: CakePHP Video Tutorials
> > > > >http://tv.cakephp.org
> > > > > Check out the new CakePHP Questions
> sitehttp://ask.cakephp.organdhelp
> > > > > 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
>

-- 
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: Surreal login mandelbug

2011-09-05 Thread CaStarCo
Hello another time:

finally, the problem was in the 'Security.level' constant , setting it to
'low' solved the problem . The 'CheckAgent' option was not important to
solve the problem.

-- 
- Per la llibertat del coneixement -
- Per la llibertat de la ment...   -

-- 
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: cant show the image after upload it

2011-09-05 Thread WebbedIT
Hi Ms Liz,

That's a lot of code when all we need to see is the code related to
showing an image.  It;s important to provide your code when asking for
help, but try to only provide the relevant stuff as a lot of ppl will
look at that and run.

Can you confirm if the images are uploaded and can you access them
direct from a url?

>From a scan of your code the relevant code to show an image is:

if(($showImage==1)&&(!empty($image1))) {
  debug($image1);die();
  //echo $html->image('files/'.$image1);
  //echo $html->link('delete','/delete/'.$image1);
} ?>

What does this actually output?

HTH, Paul
@phpMagpie

On Sep 5, 8:45 am, ms_liz_87  wrote:
> Can anyone check my code? 2 images successfully uploaded into my DB
> banners table. but it supposed show the image also after i click on
> submit button.

-- 
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: CakePHP without naming convention. is it possible?

2011-09-05 Thread Cruisine
@WebbedIT
its up to 100 tables and still being accesed by that application...in
fact this application is still running..due to the integration issue
with another application which is using PHP as the engine, i need to
re-develop the application into PHP. and i considered to use Cakephp
as the framework since another application was built by this framework
as well.
just for info, the old app was built by java and i don't have an
authority to build a new database..


On Sep 5, 6:43 pm, WebbedIT  wrote:
> Cruisine,
>
> How many tables are we talking about?  Is the old application using
> this database still going to be accessing it or will your new one be
> the sole point of access?
>
> As Greg says, it certainly can be done, but soo much easier to write
> an import script and migrate the system to a new database.  May take
> some time up front, but will save so much more in the long run.
>
> HTH, Paul
> @phpMagpie
>
> On Sep 5, 8:20 am, Cruisine  wrote:
>
> > to be honest,i don't really want this happen.but what am i supposed to
> > do?i cant build new database since the current database have lots of
> > datas inside. after i read ur reply i started to think like that as
> > well.my work will be hard later. i have to define lots of things on
> > the model and i don't have an idea about the unpreddicted issues which
> > will follow later.
>
> > do you have any idea to solve this problem?
>
> > On Sep 5, 10:39 am, Greg Skerman  wrote:
>
> > >http://book.cakephp.org/view/1057/Model-Attributesisagood place to start.
>
> > > you can configure in most circumstances cake to talk to any old database -
> > > you just end up losing some of the magic and writing more code as a 
> > > result.
>
> > > for a model which does not comply with the convention you will at least 
> > > need
> > > to:
>
> > > 1) define the table name ($useTable)
> > > 2) define the primary key ($primaryKey)
> > > 3) define the display name ($displayName)
>
> > > you'll also need to provide more verbose settings in the model 
> > > associations
> > > in order to get them to play nice...
>
> > > On Mon, Sep 5, 2011 at 9:34 AM, Cruisine  wrote:
> > > > hi guys, i need to know something important about naming convention.
> > > > yeah, i've been using naming convention while developing all my app
> > > > all the time. but recently a problem appeared. let say  i've got a
> > > > project to re-developing an app ( from non-cakephp to cakephp) which
> > > > already had a database. and of course since the app hadn't been built
> > > > by cakephp the database also didn't follow the cakephp naming
> > > > convention rules.
> > > > the question i have is, how do i make an application using cakephp
> > > > with that database?is it still possible to  built a cakephp project
> > > > without following naming convention rules?
>
> > > > need ur help soon.thank you.
>
> > > > --
> > > > Our newest site for the community: CakePHP Video Tutorials
> > > >http://tv.cakephp.org
> > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > > > 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: Fetch Related Data

2011-09-05 Thread WebbedIT
When running a find on User Cake will automatically retrieve related
belongsTo and hasOne data so you should already have this available.

Show us your find call and also the results ot echo
debug($your_find_data); so we can see what your trying to find and are
actually getting.

HTH, Paul
@phpMagpie

On Sep 5, 9:37 am, tubiz  wrote:
> I have a user and a profile table in my a cakephp application I am
> developing. In my model files my User Model a user hasOne profile and
> in my  Profile Model a profile belongsTo a user.
>
> I am using the user table to validate a user login.
> In my profile table there is a user_id field containing the id of the
> user in the user table.
>
> But the problem I am having is that is it possible to fetch a user
> profile after he login based on the user_id field in the profile table
> and not using the id field in the user table.
>
> Would like to know how to do this, or is there a way for me to fetch
> all a User data from other table using the value of the user_id in the
> other table.

-- 
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: Persson Queue Plugin - job progress inspection

2011-09-05 Thread WebbedIT
Can't give info on Gearman, but Mark Storey did a talk on Evented apps
using RabbitMQ @ CakeFest:
http://www.slideshare.net/markstory/evented-applications-with-rabbitmq-and-cakephp

HTH, Paul
@phpMagpie

On Sep 4, 11:41 am, Eric Blanpied  wrote:
> Hello,
>
> I'm working on an app which needs to manage a number of large file
> transfers (gigs of full-HD video files) on a periodic basis, and am
> planning to implement this via some sort of job queue system with curl-
> based workers taking the activity offline from the browser. I had been
> planning to use Gearman, but upon discovering the Queue plugin I've
> been investigating that Beanstalk-based approach.
>
> My question is about inspecting the progress of the individual jobs. I
> would like to be able to have a page with feedback on how the jobs are
> progressing, along with a progress percentage for each file's
> download. I haven't been able to find any info on how one would get
> any kind of data back from a worker mid-job, whether in the context of
> David's plugin, or Beanstalk in general. It looks as though this is
> more straightforward in Gearman.
>
> Can anyone shed any insight? Any input on how hard it would be to add
> Gearman support to the Queue plugin?
>
> thanks
>
> -eric

-- 
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: cakephp 2 app deployed on a subdomain

2011-09-05 Thread WebbedIT
Cake 2.0 beings some canges to the router to help with subdomains that
were touched on at CakeFest:
http://book2.cakephp.org/en/appendices/new-features-in-cakephp-2-0.html?highlight=subdomain

HTT, Paul
@phpMagpie

On Sep 5, 1:38 am, "#2Will"  wrote:
> comparing debug($_SERVER) between local and stage sites
>
> local:      [PHP_SELF] => /app/webroot/index.php/people/login
> stage:    [PHP_SELF] => /app/webroot/people/login
>
> This seems like a likely to be relevent, but what could be causing
> it?  I think i have all my htaccess files present.
>
> Looking at other apps ive deployed to subdomain-stage , the PHP_SELF
> is /app/webroot/index.php  without the /controller/action   - but
> thats 1.3 apps.
>
> hmm.  more digging.
>
> On Sep 5, 10:11 am, "#2Will"  wrote:
>
>
>
>
>
>
>
> > just running some debug statements looking at paths:
>
> > debug(ROOT);
> > debug(WWW_ROOT);
> > debug(WEBROOT_DIR);
> > debug(APP_DIR);
> > debug(APP_PATH);
> > gives me
>
> > /home/kindlem1/public_html/elip
> > /home/kindlem1/public_html/elip/app/webroot/
> > webroot
> > app
> > /home/kindlem1/public_html/elip/app/
>
> > Which i think looks as expected.
>
> > On Sep 5, 9:58 am, "#2Will"  wrote:
>
> > > Sorry, forgot to mention: i'm on 2.0 rc1
>
> > > On Sep 5, 9:56 am, "#2Will"  wrote:
>
> > > > Hello
>
> > > > I have deployed a little app to a subdomain as a stage environment -
> > > > iv'e done this before with 1.3 apps and not had to do anything special
> > > > to get it to work. The app works on my localhost
>
> > > > I'm getting errors where for example the login form now gives error
>
> > > > Error: The requested address '/app/webroot/people/people/login' was
> > > > not found on this server
>
> > > > and if i enable debug in config.php debug kit gives is broken, with
> > > > files missing because they are pointing to wrong addresses
>
> > > > eg:  app/webroot/people/debug_kit/js/js_debug_toolbar.js
>
> > > > Is there something special i need to do for cakephp2 apps in
> > > > subdomains?
>
> > > > Thanks v much for any help,
>
> > > > will

-- 
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: CakePHP without naming convention. is it possible?

2011-09-05 Thread WebbedIT
Cruisine,

How many tables are we talking about?  Is the old application using
this database still going to be accessing it or will your new one be
the sole point of access?

As Greg says, it certainly can be done, but soo much easier to write
an import script and migrate the system to a new database.  May take
some time up front, but will save so much more in the long run.

HTH, Paul
@phpMagpie

On Sep 5, 8:20 am, Cruisine  wrote:
> to be honest,i don't really want this happen.but what am i supposed to
> do?i cant build new database since the current database have lots of
> datas inside. after i read ur reply i started to think like that as
> well.my work will be hard later. i have to define lots of things on
> the model and i don't have an idea about the unpreddicted issues which
> will follow later.
>
> do you have any idea to solve this problem?
>
> On Sep 5, 10:39 am, Greg Skerman  wrote:
>
>
>
>
>
>
>
> >http://book.cakephp.org/view/1057/Model-Attributesisa good place to start.
>
> > you can configure in most circumstances cake to talk to any old database -
> > you just end up losing some of the magic and writing more code as a result.
>
> > for a model which does not comply with the convention you will at least need
> > to:
>
> > 1) define the table name ($useTable)
> > 2) define the primary key ($primaryKey)
> > 3) define the display name ($displayName)
>
> > you'll also need to provide more verbose settings in the model associations
> > in order to get them to play nice...
>
> > On Mon, Sep 5, 2011 at 9:34 AM, Cruisine  wrote:
> > > hi guys, i need to know something important about naming convention.
> > > yeah, i've been using naming convention while developing all my app
> > > all the time. but recently a problem appeared. let say  i've got a
> > > project to re-developing an app ( from non-cakephp to cakephp) which
> > > already had a database. and of course since the app hadn't been built
> > > by cakephp the database also didn't follow the cakephp naming
> > > convention rules.
> > > the question i have is, how do i make an application using cakephp
> > > with that database?is it still possible to  built a cakephp project
> > > without following naming convention rules?
>
> > > need ur help soon.thank you.
>
> > > --
> > > Our newest site for the community: CakePHP Video Tutorials
> > >http://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > > 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: saveAll not working

2011-09-05 Thread WebbedIT
Sorry, read Stephen's first reply without fully reading the OP.
You're just trying to save one model row with it's many relations.

Your data array looks correct, so I would suggest there are some
validation errors.  Try echo debug($this->validationErrors); in your
view as it will show you if any of the models failed on save and why.

Sorry for above post, Paul
@phpMagpie

On Sep 5, 11:37 am, WebbedIT  wrote:
> Stephen is right, you cannot save Multiple AND Related at the same
> time using saveAll in 1.3
>
> You would have to foreach() through your array of data and run saveAll
> multiple times, ensuring the data for each saveAll() call matched what
> was required for saving a single row plus it's related data.
>
> HTH, Paul
> @phpMagpie
>
> On Sep 3, 6:59 pm, Stephen Latham  wrote:
>
>
>
>
>
>
>
> > I thought this was possible too with saveall but I had no luck with it.  I
> > have used saveall but only to save multiple items for a single model.  When
> > i tried to use it (as you are) to save multiple and associated records
> > together it didn't play at all.
>
> > This is taken directly from the cook book for v1.3: -
>
> > saveall - "Used to save (a) multiple individual records for a single model
> > or (b) this record, as well as all associated records"
>
> > When i had no luck in doing what you are doing i took that "or" in the above
> > to mean it can't do both at the same time.  Further on in the page it
> > explains saving using keying so i used that method.
>
> > I would love someone to come on and explain how to use saveall to do both as
> > it would be a lot neater than forech loops and keying but i'm not convinced
> > it can.
>
> > Cheers,
>
> > Steve
> > On 3 September 2011 09:18, Dwayne Hanekamp  wrote:
>
> > > Thanks for all the response!
>
> > > Teddy,
> > > Yes this is a copy of the print_r, though i changed the parameters to
> > > make it more clear.
> > > Where can i find the sqllog? Is that the sql dump on the bottom?
>
> > > Stephen,
> > > It really is possible, i've seen some tutorials on it.
>
> > > John,
> > > I am not calling model::create() before it
> > > Yes, my parentmodel has validation.
>
> > > Dwayne
>
> > > On 2 sep, 18:39, John Hardy  wrote:
> > > > Are you calling
> > > > Model::create()
> > > > before you atempt to save the record?
> > > > Is your parent model validating?
>
> > > > I use save all a bunch and make it a habbit of checking these things.
>
> > > > Saveall works a-ok ;)
>
> > > > Sent from my iPhone
>
> > > > On Sep 2, 2011, at 9:29 AM, Stephen Latham  wrote:
>
> > > > > If you have a read of the manual it says you can either save multiple
> > > records of a single model using saveall, or a model and it's associated
> > > records.  You are trying to do both at once with the save all.  That's my
> > > understanding of it anyway - I had a similar issue with saveall so ended 
> > > up
> > > just using foreach loops to save the data instead.  I have used saveall
> > > where I wanted to do one or the other but never both at the same time as 
> > > you
> > > are trying.
>
> > > > > Cheers Steve.
>
> > > > > On 2 Sep 2011, at 11:35, Dwayne Hanekamp 
> > > wrote:
>
> > > > >> Hey all,
>
> > > > >> I'm building an application on which people need to fill in some
> > > > >> information and answer some questions.
> > > > >> I have two database tables:
> > > > >> Applications / Answers, Applications has a 'hasMany'-relationship 
> > > > >> with
> > > > >> Answers. The array coming from my form looks this way:
>
> > > > >> Array
> > > > >> (
> > > > >>   [Application] => Array
> > > > >>       (
> > > > >>           [name] => test
> > > > >>           [email] => t...@test.nl
> > > > >>           [name] => test
> > > > >>           [link] => test
> > > > >>       )
>
> > > > >>   [Answer] => Array
> > > > >>       (
> > > > >>           [0] => Array
> > > > >>               (
> > > > >>                   [question_id] => 1
> > > > >>                   [answer] => test
> > > > >>               )
>
> > > > >>           [1] => Array
> > > > >>               (
> > > > >>                   [question_id] => 2
> > > > >>                   [answer] => test
> > > > >>               )
>
> > > > >>       )
>
> > > > >> )
>
> > > > >> When i try to do: $this->Application->saveAll($this-data); it simply
> > > > >> doesn't work.
>
> > > > >> Does anyone have an idea?
>
> > > > >> Thanks in advance!
>
> > > > >> Dwayne
>
> > > > >> --
> > > > >> Our newest site for the community: CakePHP Video Tutorialshttp://
> > > tv.cakephp.org
> > > > >> Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > > 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 Tutorialshttp://
> > > tv.cakephp.org
> > > > > Check out the new Ca

Re: Clone Site Error

2011-09-05 Thread WebbedIT
I find the more I sit there saying "I know this was working 10 minutes
ago, nothing can be wrong" the less likely I am to find the
solution.

I would, leave debug on, strip all joins out of the first model you
access then slowly add them back in till you find the model that has
your rougue call.

HTH, Paul
@phpMagpie

On Sep 4, 10:21 am, Ryan Schmidt  wrote:
> On Sep 3, 2011, at 20:36, Krissy Masters wrote:
>
> > Its already maxed at 64M
>
> > Both sites are small. 3 tables mostly all statc pages, not heavy at all. 
> > Very little sql calls and what ever calls are cached anyways so there is no 
> > demand what so ever. And it only appears on 1 site. Why does it not show on 
> > both if there was a memory problem?
>
> I agree it is odd that you see the problem with the clone, and not with the 
> original, if they're running on the same server, and that therefore the 
> memory setting is probably not relevant.
>
> However, note that the default max memory allocation for PHP 5.3.x is 128MB, 
> so you're running at half that and it's therefore not surprising some things 
> would fail.
>
> http://us3.php.net/ini.core#ini.sect.resource-limits

-- 
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: CakePHP Auth redirection not classed as referrer

2011-09-05 Thread WebbedIT
If someone types in the address, or follows a bookmark (happens all
the time as user bookmarks the login page), there is no referer as
they have not clicked on a link from another page.

Try: http://book.cakephp.org/view/1270/loginRedirect
(which by the way says the referer is only populated from links to
pages within your site)

HTH, Paul
@phpMagpie

On Aug 29, 11:18 pm, driz  wrote:
> When a user tries to access a protected action they are automatically
> taken to the login form which then sets the previous page in a session
> called Auth.Redirect and on successful login sends the user back to
> that session value.
>
> However if I put a check to see the referrer it will NOT show the
> previous URL!
>
> This causes a problem in my app as I do a check in the code to see if
> a user has come direct to the login page (typed it in the address bar)
> or has come from another page within the app.
>
> e.g.
>
> $referer = env('HTTP_REFERER');
>
> if(empty($referer)
> {
>     'user has typed the url manually or clicked a link from an
> external website';
>
> }
>
> The issue is that when a user is taken to the login form by the auth
> component it will leave the referer empty! But this is wrong as the
> referer WAS the last page!
>
> a) is this a bug in CakePHP? Why isn't it being classed as a refer?
>
> b) how do I get around this?
>
> Cheers

-- 
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: How to retrieve data which is posted to secure page

2011-09-05 Thread WebbedIT
beinng shown a form that you fill in only to be presented with a "you
must login to submit this form" message.  H, no thanks.

Also if the data is to eventually be secure (i.e. encrypted) how is it
secure when sent from http?!?

@phpMagpie

On Sep 2, 10:50 am, euromark  wrote:
> you should as a guideline always post a form to itself.
> therefore the same action can work with the posted data and afterwards
> redirect to the secure page
>
> On 1 Sep., 22:27, vinay  wrote:
>
>
>
>
>
>
>
> > Hi,
> > Looking for help on implementing requirement where user will see a
> > form even without logging in to the website. Once user submit the form
> > the data is posted to secured page, that' s why user is redirected to
> > login page.
> > How do I get the data posted by user because based on that I need to
> > show him next step once he logged in.
>
> > THanks,
> > Vinay

-- 
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: Surreal login mandelbug

2011-09-05 Thread CaStarCo
Hello, I've solved the problem thanks to Teddy Zeeny.

The problem was solved turning off the CheckAgent option in the core.php
file, and setting the security level to "low". Now I'm not in the office and
I can't verify what of those options are the "important" in my case, this
afternoon I'll write more precisely about the solution :) .

2011/9/5 WebbedIT 

> Are you sure the login is authenticating (Does the session include the
> user details)?
>
> If so, where should an authenticated user be redirected to?  Are you
> sure the users who is logging in is then Authorised to view the page
> they are being redirected to?
>
> HTH, Paul
> @phpMagpie
>
> On Sep 2, 3:14 pm, CaStarCo  wrote:
> > Daniel, that's not my problem. In the development environment i have no
> > problem (using localhost or the ip, this don't care, both options work
> > well).
> >
> > My problem is with the production environment, I'm using a typical url,
> with
> > it's domain name and directories... (
> http://www.ub.edu/areintra/apps/Yoda)
> >
> > 2011/9/2 Daniel Luiz Pakuschewski 
> >
> > > I saw this bug last week but i dont had time to debug and check where
> > > is the problem.. but to me, Auth just bug like you said if i try to
> > > access app with IP of server.. if o access with domain all work
> > > fine... Ex.. 127.0.0.1/app will not work. but localhost/app work fine.
> >
> > > --
> >
> > - Per la llibertat del coneixement -
> > - Per la llibertat de la ment...   -
>
> --
> 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
>



-- 
- Per la llibertat del coneixement -
- Per la llibertat de la ment...   -

-- 
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: Multiple controllers linked to a single model

2011-09-05 Thread WebbedIT
IMO: You're creating a world of hurt for yourself by not having a
seperate table, model, conrtoller etc. for News, Events, Bookings as
they will all have their own fields and logic required.  Stick to the
conventions, there are so many good reasons why they eist.

HTH, Paul
@phpMagpie

On Sep 2, 12:24 pm, Teddy Zeenny  wrote:
> You can set: var $uses=array('ModelName') in each of the controllers.
>
> But just my opinion:
>
> Don't name the table "objects" because your model name would be Object which
> is a class that already exists in CakePHP.
>
> Second, why link multiple controllers to one model. Instead, link multiple
> models to one table.  Then you would have EventsController which
> automatically links to Event model which uses table 'objects'.  News
> automatically links to New Model which in turn uses 'objects' table.. etc
>
> Then in the Event model for example you could have:
>
> var $useTable='objects';
>
> function beforeFind($queryData)
> {
>   return Set::merge($queryData ,
> array('conditions'=>array('Event.item_type'=>'event')));
>
> }
>
> I'm just brainstorming ... :) Just let me know what you think...
>
>
>
>
>
>
>
> On Thu, Sep 1, 2011 at 7:51 AM, Heshanh  wrote:
> > I have a table called 'objects' and each record has an item_type.
> > for example :
> > row 1:
> > id = 1
> > item_type = event
>
> > row 2:
> > id =2
> > item_type = news
>
> > row 3:
> > id =3
> > item_type = booking
>
> > I have a model for the table but is it possible to have multiple
> > controllers accessing this model,
> > I want to have an events controller that will handle all the events,
> > news controller that will handle all the news... and so on
>
> > is this possible for cakePhp?
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://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: Surreal login mandelbug

2011-09-05 Thread WebbedIT
Are you sure the login is authenticating (Does the session include the
user details)?

If so, where should an authenticated user be redirected to?  Are you
sure the users who is logging in is then Authorised to view the page
they are being redirected to?

HTH, Paul
@phpMagpie

On Sep 2, 3:14 pm, CaStarCo  wrote:
> Daniel, that's not my problem. In the development environment i have no
> problem (using localhost or the ip, this don't care, both options work
> well).
>
> My problem is with the production environment, I'm using a typical url, with
> it's domain name and directories... (http://www.ub.edu/areintra/apps/Yoda)
>
> 2011/9/2 Daniel Luiz Pakuschewski 
>
> > I saw this bug last week but i dont had time to debug and check where
> > is the problem.. but to me, Auth just bug like you said if i try to
> > access app with IP of server.. if o access with domain all work
> > fine... Ex.. 127.0.0.1/app will not work. but localhost/app work fine.
>
> > --
>
> - Per la llibertat del coneixement -
> - Per la llibertat de la ment...       -

-- 
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: Using GET not POST returns empty $this->data

2011-09-05 Thread WebbedIT
Thomas,

It is a VERY bad idea to accept data via GET that you are going to
write into your database.  Please do not do it, you should only accept
POST data and as such your function should go back to the standard:

if(!empty($this->data)) {

} else {

}

CakePHP has built in security and takes anything submitted via POST
and transfers it into $this->data for you so the above code
essentially says "only save data if submitted by a form".  If you use
the form helper it creates the data array in exactly the right format
so you can simply call $this->Model->save();  Ideally you should also
enable the security component which will insert a token into your
forms too ensure your forms are being submitted from your site and not
being tampered with before submission.

The main thing to learn is, if you are going to use CakePHP, stick to
it's conventions.  Those conventions were created by a bunch of very
clever people, as soon as you try doing things differently you are
making your life sooo much harder and most probably weakening various
aspects of your application.

HTH, Paul
@phpMagpie

On Sep 3, 4:01 pm, Thomas  wrote:
> I found that just created a post when I clicked "Add" without giving a
> screen to create 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: Using $this->set in view doesn't set the var

2011-09-05 Thread Xoubaman
Me neither, until now :)

On the topic of setting vars in an element, regardless of it being wrong or 
not, the point is that it's possible. At least the doc says so, but it's not 
working for me (the Var::set() method).

You may have an element that gets data from requestAction and, depending on 
the returned values, subsecuent layout contents will need different vars 
defined.

-- 
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: saveAll not working

2011-09-05 Thread WebbedIT
Stephen is right, you cannot save Multiple AND Related at the same
time using saveAll in 1.3

You would have to foreach() through your array of data and run saveAll
multiple times, ensuring the data for each saveAll() call matched what
was required for saving a single row plus it's related data.

HTH, Paul
@phpMagpie

On Sep 3, 6:59 pm, Stephen Latham  wrote:
> I thought this was possible too with saveall but I had no luck with it.  I
> have used saveall but only to save multiple items for a single model.  When
> i tried to use it (as you are) to save multiple and associated records
> together it didn't play at all.
>
> This is taken directly from the cook book for v1.3: -
>
> saveall - "Used to save (a) multiple individual records for a single model
> or (b) this record, as well as all associated records"
>
> When i had no luck in doing what you are doing i took that "or" in the above
> to mean it can't do both at the same time.  Further on in the page it
> explains saving using keying so i used that method.
>
> I would love someone to come on and explain how to use saveall to do both as
> it would be a lot neater than forech loops and keying but i'm not convinced
> it can.
>
> Cheers,
>
> Steve
> On 3 September 2011 09:18, Dwayne Hanekamp  wrote:
>
>
>
>
>
>
>
> > Thanks for all the response!
>
> > Teddy,
> > Yes this is a copy of the print_r, though i changed the parameters to
> > make it more clear.
> > Where can i find the sqllog? Is that the sql dump on the bottom?
>
> > Stephen,
> > It really is possible, i've seen some tutorials on it.
>
> > John,
> > I am not calling model::create() before it
> > Yes, my parentmodel has validation.
>
> > Dwayne
>
> > On 2 sep, 18:39, John Hardy  wrote:
> > > Are you calling
> > > Model::create()
> > > before you atempt to save the record?
> > > Is your parent model validating?
>
> > > I use save all a bunch and make it a habbit of checking these things.
>
> > > Saveall works a-ok ;)
>
> > > Sent from my iPhone
>
> > > On Sep 2, 2011, at 9:29 AM, Stephen Latham  wrote:
>
> > > > If you have a read of the manual it says you can either save multiple
> > records of a single model using saveall, or a model and it's associated
> > records.  You are trying to do both at once with the save all.  That's my
> > understanding of it anyway - I had a similar issue with saveall so ended up
> > just using foreach loops to save the data instead.  I have used saveall
> > where I wanted to do one or the other but never both at the same time as you
> > are trying.
>
> > > > Cheers Steve.
>
> > > > On 2 Sep 2011, at 11:35, Dwayne Hanekamp 
> > wrote:
>
> > > >> Hey all,
>
> > > >> I'm building an application on which people need to fill in some
> > > >> information and answer some questions.
> > > >> I have two database tables:
> > > >> Applications / Answers, Applications has a 'hasMany'-relationship with
> > > >> Answers. The array coming from my form looks this way:
>
> > > >> Array
> > > >> (
> > > >>   [Application] => Array
> > > >>       (
> > > >>           [name] => test
> > > >>           [email] => t...@test.nl
> > > >>           [name] => test
> > > >>           [link] => test
> > > >>       )
>
> > > >>   [Answer] => Array
> > > >>       (
> > > >>           [0] => Array
> > > >>               (
> > > >>                   [question_id] => 1
> > > >>                   [answer] => test
> > > >>               )
>
> > > >>           [1] => Array
> > > >>               (
> > > >>                   [question_id] => 2
> > > >>                   [answer] => test
> > > >>               )
>
> > > >>       )
>
> > > >> )
>
> > > >> When i try to do: $this->Application->saveAll($this-data); it simply
> > > >> doesn't work.
>
> > > >> Does anyone have an idea?
>
> > > >> Thanks in advance!
>
> > > >> Dwayne
>
> > > >> --
> > > >> Our newest site for the community: CakePHP Video Tutorialshttp://
> > tv.cakephp.org
> > > >> Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > 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 Tutorialshttp://
> > tv.cakephp.org
> > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > 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 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:/

Re: Issues With Auth Component

2011-09-05 Thread WebbedIT
You should really look at modifying your auth() configuration so you
can move the authorisation work out of the controller actions and into
Controller::isAuthorized();

In your appController (if applying to whole app) you could do $this-
>Auth->authorize = 'controller';

The you create an isAuthorized() action in each of your controllers
which runs after a user has been authenticated.  In here you can run
any php code you want and return true if the user is allowed access to
the requested resource or false if not.

Book page:
http://book.cakephp.org/view/1275/authorize

HTH, Paul
@phpMagpie

On Sep 4, 1:55 pm, tubiz  wrote:
> Hi andrewperk am really grateful for you help so far. Thanks a lot
> before I got the reply I was able to figure it out.
>
> One last problem I am having is that if a user want to edit his
> profile and the id field for  the user in the profile table is 1 but
> the value of the loggedin user id is 2 a user trying  to edit his
> profile wont be able to edit his profile instead he would be editing
> the users whose id is 2 in the profile table  because whenever a user
> is trying to edit his profile I am passing the value of loggedin user
> id from the user table.
>
> Is there a way for me to edit a profile targeting the user_id in the
> profile table instead of the id in the profile table.
>
> On Sep 4, 3:15 am, andrewperk  wrote:
>
>
>
>
>
>
>
> > I can try to give you some tips on how to build your code and the
> > logic behind it.
>
> > I assume your user model has a (hasOne) relationship to the profile
> > model and the profile model has a (belongsTo) relationship to the User
> > model, right?  A user can have a single profile. In the profiles table
> > there's a user_id field to relate that profile to a user.
>
> > You should then be able to do a check on the logged in user''s
> > associated profile to see if a profile even exists. You can do this by
> > looking in the profile table to see if one has a user_id field equal
> > to your logged in user's id. If you find a row with a user_id field
> > equal to your logged in user that means they have created a profile
> > already, if not, they don't have a profile. You would do something
> > like:
>
> > function addProfile() {
> >     // Try to find a profile that belongs to the logged in user's ID
> >     $profile = $this->Profile->findByUserId($this->Auth->user('id'));
>
> >     // If it's not empty, that means the logged in user's profile was
> > found, so redirect out
> >     if (!empty($profile)) {
> >         $this->Session->setFlash(array('You already have a profile'));
> >         $this->redirect(array('controller'=>'users',
> > 'action'=>'index'));
> >     }
>
> >     // If they got here they don't have a profile, create a new one,
> >     // your add a profile code goes here...
>
> > }
>
> > There might be a better way to check this, possibly through the User
> > model association but this was just off the top of my head and should
> > get you headed in the right direction.
>
> > On Sep 3, 2:27 pm, tubiz  wrote:
>
> > > Really grateful for your help. It is now working as I wanted it to
> > > didn't know it was this simple but I was thinking in this direction.
>
> > > But I am having another problem in my cakephp application I have a
> > > function called addProfile I would like the function to be displayed
> > > to a user that has logged in and hasnt setup his profile but if he has
> > > set it up he should be directed to the Users Homepage.
>
> > > On Sep 3, 5:48 pm, andrewperk  wrote:
>
> > > > It's pretty simple, just use a conditional to compare the logged in
> > > > user's ID to the ID passed in to the URL. If it doesn't match then
> > > > they get redirected back to the edit page but this time passing in
> > > > their ID rather than the one they tried to use. This should ensure
> > > > only the current user can edit their current profile. Each time the
> > > > user enters in an ID when trying to access the edit page and that ID
> > > > doesn't match their ID they will get redirected.
>
> > > > function edit($id = null) {
> > > >                 if (!$id && empty($this->data)) {
> > > >                         $this->Session->setFlash(__('Invalid profile',
> > > > true));
> > > >                         $this->redirect(array('action' => 'index'));
> > > >                 }
> > > >                 // Check if the logged in user's id matches the passed
> > > > in id
> > > >                 // if not redirect to their edit page
> > > >                 if ($id != $this->Auth->user('id')) {
> > > >                         $this->redirect(array('action'=>'edit', 
> > > > $this->Auth->user('id'));
>
> > > >                 }
> > > >                 if (!empty($this->data)) {
> > > >                         if ($this->Profile->save($this->data)) {
> > > >                                 $this->Session->setFlash(__('The
> > > > profile has been saved', true));
> > > >                                 $this->redirect(array('action'

Re: custom validation rules - custom message

2011-09-05 Thread WebbedIT
The return value from the model's custom validation method becomes the
custom message.

HTH, Paul
@phpMagpie

On Sep 2, 8:40 pm, Christophe Vandeplas 
wrote:
> Hello,
>
> I have a model where a field needs a valudation rule to verify if the
> value already exists.
> The easy way to implement this is by using the isUnique validation.
>
> However I want to also modify the message the user gets to give him an
> url to a location where that value/field is already used.
> So instead of a message like "Sorry this is already used."
> I want to tell "Sorry this is already used, check out this place {URL}
> to see it."
>
> I tried to play with the $this variable in a custom validation,
> however
>         $this->validate['value']['unique']['message'] = "foo";
> doesn't change the message when I set it from inside the validation
> rule.
>
> function signatureExists($check) {
>         debug($this->validate);
>         $this->validate['value']['unique']['message'] = "foo";
>         return $this->isUnique($check);
>     }
>
> Is there a (supported or unsupported) way to change the validation
> rule?
> Of course I'd like to keep it in my model and not in my view for
> cleanness of code.
>
> Thanks a lot for your expertise.
> Have a great day
>
> Christophe

-- 
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: how to attach image in ajax link

2011-09-05 Thread WebbedIT
When having fairly simple problems like this it is very rewarding, and
quicker, to solve them yourself.

Break the process down into steps and then piece it back together.
For example you could:

1. Read about Html::image() and ensure you can get your image
displaying
http://book.cakephp.org/view/1441/image

2. Read about Ajax::link() and get an ajax link working as a text link
http://book.cakephp.org/view/1363/link

3. Take the working HTML::image() code and use it to replace the text
in the link you created in step 2

Tip: the bit you're probably struggling with is the boolean
$escapeTitle in Ajax::link(); and always look at the code outputted
when something is not working, manually create the code yourself and
try and figure out what part of your CakePHP code is not working as
expected.

HTH, Paul
@phpMagpie

On Sep 1, 11:59 am, taqman filler  wrote:
>  link(($html->image("like",array('escape'=>false))),'/user_articles/vote/up/'.$article['Article']['id'],array('update'=>'vote_'.$article['Article']['id']),null,false);?>
> out put
> 
> before ask
> I try to find answer in group and follow it but doesn't work
> how to fix 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: 2.0 is pretty awesome

2011-09-05 Thread Elte Hupkes
I agree, it rocks (yay, now it's a feelgood topic ^^).

Every time I find myself frustrated because I'm trying to do something
that used to work in 1.3 and doesn't anymore in 2.0, I realize it's
because 2.0 has a way better solution for it. Also I found response
times cut significantly, not only _are_ they faster, they _feel_
faster.

So, awesome work guys :).

On 5 sep, 02:25, mark_story  wrote:
> Thanks for the feedback Parris.  Glad to hear you like the code and
> docs changes.  :)
>
> -Mark
>
> On Sep 3, 10:08 pm, Parris  wrote:
>
>
>
>
>
>
>
> > Thanks guys :)!
>
> > I love the consistency. The docs are awesome (although it is easier to
> > setup on linux than on windows. I did it on both.). I especially like
> > that you allow email settings to be entered in like database settings.
> > Convertinghttp://letswoosh.comtoit now trying out the new testing
> > tools at the same time.

-- 
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: Using $this->set in view doesn't set the var

2011-09-05 Thread WebbedIT
I have never accessed anything from $this->viewVars, once set a
variable is accessed from $variableName.

Something sounds wrong with your methodology If you're setting
variables in an element to be used in other elements/parts of the
layout.  An element by definition is a contained collection of view
code, not sure why it should interact during a page load with other
elements.

HTH, Paul
@phpMagpie

On Sep 1, 6:20 pm, Xoubaman  wrote:
> I have an element in layout that generates some variables I want to use
> following parts of layout and view. As read in doc
> (http://book.cakephp.org/view/1086/set), using $this->set('varname', $value)
> will result in $varname available in the layout, but I'm getting a Undefined
> variable notice.
>
> debug($this->viewVars) before the var-generating element throws something
> like:
>
> Array
> (
>     [title_for_layout] => Awesome web
>     [controller_set_var1] => lol
>     [controller_set_var2] => foo
> )
>
> Then, the element is echoed, and debugging $this->viewVars shows:
>
> Array
> (
>     [title_for_layout] => Awesome web
>     [controller_set_var1] => lol
>     [controller_set_var1] => lol
>     [element_set_var] => gotcha!
> )
> But $element_set_var stills undefined.
>
> Is this the normal behavior? Should I take $element_set_var manually from 
> $this->viewVars?

-- 
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: dropdown onchange send ajax submit

2011-09-05 Thread WebbedIT
You are nearly there as you've tried adding an onChange event to
DealQuantity.

Problem is 'onchange'=> 'ajax submit' isn't going to do anything as
it's not a valid javascript call.  It looks as though you've used the
$ajax->submit() function from the Ajax Helper and assumed you can type
in a similar string into your field's onchange attribuite. If you have
FireBug or something similar enabled (and you should if doing any
JavaScript work) then you would see an error when that onChange event
fires.

Hint: look at the code $ajax.submit() is outputting and you should
find your answer in there.

HTH, Paul.
@phpMagpie

On Aug 31, 6:34 am, abhimanyu bv  wrote:
> hi all,
> i created a form(below).
>                                  echo $this->Form->create('Deal');
>                                 echo $this->Form->hidden('deal_id', 
> array('value' =>
> $deal['deal_id']));
>
>                                 $options = array(1 => 1,2 => 2,3 => 3,4 => 
> 4,5 => 5);
>                                 echo $this->Form->input('quantity', array( 
> 'type' => 'select',
> 'label' => '' , 'value' => $deal['value'] ,
>                                                                               
>   'onchange'=> 'ajax submit','options' => $options));
>                                 echo $ajax->submit('update', array('url'=>
> array('controller'=>'deals', 'action'=>'cart'), 'update' =>
> 'shoppingcart'));
>                                 echo $this->Form->end();
> ?>
> what i done is there is a select box and update button. If i select a
> value in dropdown and clicks submit,then ajax method is working, but i
> dont want to give update button in that form,instead i want to have an
> onchange event for the dropdown, so that if user selects a value, the
> form is updated. how to do this?
> If i am giving the onchange as this.form.submit(), then it is taking
> as normal request. Is there any simple solution to this/

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


Fetch Related Data

2011-09-05 Thread tubiz
I have a user and a profile table in my a cakephp application I am
developing. In my model files my User Model a user hasOne profile and
in my  Profile Model a profile belongsTo a user.

I am using the user table to validate a user login.
In my profile table there is a user_id field containing the id of the
user in the user table.

But the problem I am having is that is it possible to fetch a user
profile after he login based on the user_id field in the profile table
and not using the id field in the user table.

Would like to know how to do this, or is there a way for me to fetch
all a User data from other table using the value of the user_id in the
other table.

-- 
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: cant show the image after upload it

2011-09-05 Thread ms_liz_87

Can anyone check my code? 2 images successfully uploaded into my DB
banners table. but it supposed show the image also after i click on
submit button.

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


cant show the image after upload it

2011-09-05 Thread ms_liz_87
//inside banners_controller.php


set('showImage', 1);
if(!empty($this->data)){
$screenshotError0 = 
$this->data['Banner']['0']['screenshot']
['error'];
$mimeType= trim($this->data['Banner']['0']
['screenshot']['type']);

if ($screenshotError0 == 0) {
$screenshot = new File($this->data['Banner']['0']
['screenshot']['tmp_name']);

if (!strstr($mimeType,'image')) {
$this->set('error', 'Unsupported screenshot 
format
or filesize too large.');
} else {
$fileName0 = $this->data['Banner']['0']
['screenshot']['name'];
$fileName1 = $this->data['Banner']['1']
['screenshot']['name'];
$uploadFolder0 = 'files/'.$fileName0;
$uploadFolder1 = 'files/'.$fileName1;
move_uploaded_file($this->data['Banner']['0']
['screenshot']['tmp_name'],$uploadFolder0);
move_uploaded_file($this->data['Banner']['1']
['screenshot']['tmp_name'],$uploadFolder1);
if(file_exists($uploadFolder0))  {
$this->set('image0',$fileName0);
$this->set('image1',$fileName1);

/* ADD THESE LINES IN YOUR CODE*/
$this->data['Banner']['name'] = '';
$this->data['Banner']['screenshot'] =
$fileName0;

$this->data['Banner']['screenshot1'] = $fileName1;
//$this->data['Banner']['link'] = 
$fileName0;
$this->data['Banner']['link1'] = 
$uploadFolder0;
$this->data['Banner']['link2'] = 
$uploadFolder1;
$this->data['Banner']['date_posted'] = 
time();
$this->Banner->create();
/* ADD THESE LINES IN YOUR CODE*/

$this->Banner->save($this->data);
//$this->set('showImage', 1);
 $this->redirect
(array('controller'=>'logins','action'=>'addbanner'));
}
}

if (!empty($fileName0)) {
$this->data['Banner']['screenshot_path'] =
$uploadFolder0;
} else {
$this->data['Banner']['screenshot_path'] = '';
}
}
}
$this->set('banners', 
$this->Banner->find('all'));

$this ->render('/logins/resources/banners/addbanner');
}
function deletebanner($image = null) {
if (!$image) {
$this->set('errMsg', 'sorry invalid link');
} else {
unlink("files/{$image}");
//$this->redirect('/uploads/index');
}
}

}

?>




//inside addbanner.ctp

element('top_nav1'); ?>




  



   

RESOURCE CENTRE BANNER 
  




   *Indicate required fields 
  

Form->create('Banner',
array('action'=>'addbanner','type'=>'file'));?>



   
   create('Banner', array('action' => 'addbanner', 'type'
=> 'file'));
echo $form->input('Banner.
0.screenshot',array('type'=>'file','label'=>'Right Banner 1 Photo:'));



 if(($showImage==1)&&(!empty($image0))) {


 debug($image0);die();

} ?>
   Form->input('link1',
array('label'=>'Right Banner 1 Link: ','style' => 'width:180px;'));?>
   





   
  





   
   input('Banner.
1.screenshot',array('type'=>'file','label'=>'Right Banner 2 Photo:'));


if(($showImage==1)&&(!empty($image1))) {

debug($image1);die();
//echo $html->image('files/'.$image1);
//echo $html->link('delete','/delete/'.$image1);
} ?>
   


 
  Form->input('link2',
array('label'=>'Right Banner 2 Link: ','style' => 'width:180px;'));?>




 



   
  


 

  



Form-
>button('Reset', array('type'=>'reset'));?>
end(__('Submit', true)); ?>








   



-- 
Our newest site for the community: CakePHP 

Re: CakePHP without naming convention. is it possible?

2011-09-05 Thread Cruisine
to be honest,i don't really want this happen.but what am i supposed to
do?i cant build new database since the current database have lots of
datas inside. after i read ur reply i started to think like that as
well.my work will be hard later. i have to define lots of things on
the model and i don't have an idea about the unpreddicted issues which
will follow later.

do you have any idea to solve this problem?


On Sep 5, 10:39 am, Greg Skerman  wrote:
> http://book.cakephp.org/view/1057/Model-Attributesis a good place to start.
>
> you can configure in most circumstances cake to talk to any old database -
> you just end up losing some of the magic and writing more code as a result.
>
> for a model which does not comply with the convention you will at least need
> to:
>
> 1) define the table name ($useTable)
> 2) define the primary key ($primaryKey)
> 3) define the display name ($displayName)
>
> you'll also need to provide more verbose settings in the model associations
> in order to get them to play nice...
>
> On Mon, Sep 5, 2011 at 9:34 AM, Cruisine  wrote:
> > hi guys, i need to know something important about naming convention.
> > yeah, i've been using naming convention while developing all my app
> > all the time. but recently a problem appeared. let say  i've got a
> > project to re-developing an app ( from non-cakephp to cakephp) which
> > already had a database. and of course since the app hadn't been built
> > by cakephp the database also didn't follow the cakephp naming
> > convention rules.
> > the question i have is, how do i make an application using cakephp
> > with that database?is it still possible to  built a cakephp project
> > without following naming convention rules?
>
> > need ur help soon.thank you.
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://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