That's exactly what I ended up doing actually :)
On 9/13/06, John Zimmerman [EMAIL PROTECTED] wrote:
Depending on your situation it might make sense to make the variable in
question a class variable of your controller.
Your reusable methods could then check and set the variable as necessary.
On 9/13/06, John Zimmerman [EMAIL PROTECTED] wrote:
The other way to do it would be to create a cronjobs_controller.php that
would have table called cronjobs full of tasks that needed to be executed
and their corresponding schedules. You could then setup a page to access in
your controller
Hi all,
I'm trying to get a feeling on CakePHP best practices.
I'd like to show each logged in user his/her full name on every page.
So, there must be something like a User-model of the loggedin user
available to every view, right?
What would be the best way to accomplish this? I was thinking
Hi Brian,
You can´t create 2 associations with the same name. You can't say a
user HasOne Venue and User HABTM Venue - if you don´t give you
associations unique names the data for both will get mixed together
(with confusing results as you have seen).
Let me clarify what that means before you
Hi Daniel,
In 1.2 that might be possible (depending on what is up the cakePhp
sleve wrt pagination) but until then, creating a paginated view is very
easy see: http://wiki.cakephp.org/tutorials:pagination
Cheers,
AD7six
--~--~-~--~~~---~--~~
You received this
Why not, when the user logs in, store the full name in the session
(along with any other details you need from the user such as their id,
aro equivalent, group/role etc.) and then in your view/layout/element
query the session and if there is a Name: display it?
HTH,
AD7six
Hi,
How to create a link to a pdf ?
I try this :
$html-image('image.gif'),/files/.$doc['path'],array('title' =
$doc['path'],'target'= '_new'), false, false)
But ... the link don't work http://URL/files/example.pdf
(error message = missing controller)
Regards,
Dom.
If the file http://URL/files/example.pdf does not actually exists,
then Cake will try to resolve the url as an controller/action
combination ... that's probably the reason that you get a missing
controller message
On 9/13/06, Dom [EMAIL PROTECTED] wrote:
Hi,
How to create a link to a pdf ?
Chris Hartjes wrote:
Now, I've added the following code into the thml template I want the
graph to appear in:
vendor('charts');
echo InsertChart($html-image('charts.swf'), charts_library,
$html-url('/graphs/users'));
charts_library is supposed to represent the location
Thank you very much for your valuable help, I will then investigate
bindModel() !
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To
One of your js files seems to be the cause. It seems likely to be due
to empty/incomplete (i)frames.
http://support.microsoft.com/?kbid=184960
http://support.microsoft.com/default.aspx?scid=kb;en-us;261188
HTH,
AD7six
--~--~-~--~~~---~--~~
You received this
Thanks ^^
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more
The queries executed are the below
1 SELECT `CreditPackage`.`credits` FROM `credit_packages` AS
`CreditPackage` WHERE id=1 LIMIT 1 1 1 0
2 SELECT `Customer`.`credits`, `Customer`.`firm` FROM `customers` AS
`Customer` WHERE id=1 LIMIT 1 1 1
What does //some rendering calls follow do..? Do you have any
requestAction calls or redirect in there (as Nate asked).
You could use the log function instead of the echo, and if your log
states:
Package_credits: 1
Old_credits: 0
New_credits: 1
Package_credits: 1
Old_credits: 1
New_credits: 2.
PPS.
You don´t need to refer to the current credits to increment the value.
$new_credits = credits + $credits; // a string
Would do the same thing, and in this way if you find you get double
increments you can be 100% certain that the reason is because the sql
is being executed twice.
Hi all.
So, let's explain the situation: I have a record called 'Review' and it
can be of different projects; the projects are listed into a selectTag
with a multiple tag (so it's a list than a dropdown menu). Now, I want
that if I select 4 projects, it inserts 4 new rows each one with the
Hi green-mamba,
Dont know about the radio function but:
green-mamba wrote:
In my controller:
$this-set('marketingsourceArray',
$this-Marketingsource-generateList(null,null,null,'id','marketing_ref'));
Try this first:
$array = $this-Marketingsource-generateList();
Hello,
I like to put a menu to every page on my site. The menu in the category
modeland I have a Helper function for menu.
I try smothing like this:
class AppController extends Controller {
var $helpers = array('Menu');
var $uses = array('Category');
function beforeRender() {
Thanks for the feedback - in the end I managed to get it working with
using:
$this-set('marketingsourceArray',
$this-Marketingsource-generateList(null,null,null,'{n}.Marketingsource.id','{n}.Marketingsource.marketing_ref'));
In my defence, however, I should say that I copied
Hi,
I have a the following code in my default.thtml layout:
echo $javascript-link('scriptaculous.js?load=effects')
it works on my index page but doesn't on deeper pages.
I Get the following error:
Notice: Undefined variable: javascript in C:\apache2triad
I have also tried:
In all likelyhood your controllers do not have the var $helpers =
array('Javascript','Ajax');
On 9/13/06, TWIOF [EMAIL PROTECTED] wrote:
Hi,
I have a the following code in my default.thtml layout:
echo $javascript-link('scriptaculous.js?load=effects')
it works on my index page but doesn't
Perfect! Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For
Scaffolding is for *prototyping* applications, not *building* them.
Scaffold has a minimum feature set for a reason. If you want to
implement pagination, you can generate the scaffolded view and
implement it yourself.
--~--~-~--~~~---~--~~
You received this
I'm just throwing up suggestions here.
Maybe the session folder is not set in your php.ini file?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to this group, send email to
Others frameworks do pagination on scaffolded view, but I want use
cakephp...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To
Could also be due to the fact that you're using IE. Not using IE
should clear the problem right up ;-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to this group, send email to
Open an Enhancement ticket at https://trac.cakephp.org/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group,
Hello, seems that mysql store dates in the following format:
-mm-dd.
How can I easily :) do, to let my application users to insert data in a
field in the following
format: dd-mm-???
Thanks,
Michele
--~--~-~--~~~---~--~~
You received this message
On Sep 13, 2006, at 9:49 AM, M wrote:
Hello, seems that mysql store dates in the following format:
-mm-dd.
How can I easily :) do, to let my application users to insert data
in a
field in the following
format: dd-mm-???
http://us2.php.net/strtotime
http://us2.php.net/date
you might look at some of the date parsing tools in php,
like
http://php.net/strtotime
but to be honest, I tend to either split out the fields for entry or
use pull downs...
Sam D
On 9/13/06, M [EMAIL PROTECTED] wrote:
Hello, seems that mysql store dates in the following format:
-mm-dd.
Hey guys, take for expample these 3 models: news ,replies and user
(news hasmany replies, replies belongsto news, user hasmany replies,
replies belongsto user)
if i do a $this-Reply-findAll(); and pr() the result, i get something
like this:
Thank you! That fixed my problem perfectly!
AD7six wrote:
Hi Brian,
You can´t create 2 associations with the same name. You can't say a
user HasOne Venue and User HABTM Venue - if you don´t give you
associations unique names the data for both will get mixed together
(with confusing results
Hi,
I'm sure many people have had the same issue I'm experiencing.
I'm working on a project where I need to get data from more than 30
models/controllers from a controller action.
I have been using the
$this-requestAction('/airports/getAirportList/' .
You could consider setting the recursive variable of models and
controllers that you don't need them to retrieve their full out
associations. The associations can take up most of the time. What is
taking up most of your time is not the actual requestaction itself, but
all the SQL queries. Turn
I also need to be able to call other controller methods such as
save($data) without the requestAction abuse performance inconveniences.
I read the article at:
http://www.thinkingphp.org/2006/06/24/welcome-to-the-dark-side-of-plugins-in-cakephp/
I think that is kind of a good approach but not
Sounds like you just need to be careful of how you pass data into the
ReplyElement you have created. For the first you pass just the $data
itself. For the second where you have multiple replies you are going
to have to use a loop.
foreach ($data['Reply'] as $row) {
with the CAKE_SESSION_SAVE set to cake you are telling it to save
sessions using CakePHP. So, maybe you don't have permissions set to
the tmp/sessions directory??
I would try chaning it to php and see if that works. Although it looks
like your sessions are getting created fine. It looks like
Hi Troy.
I set DEBUG 2 and these are my results of 1 sample request:
SQL Queries Time: 17 queries took 17 ms
Total request processing time: 1.8491s
I think 1.8 seconds is a long time considering that the SQL queries
only take 17 ms and I'm the only user of my Dev server.
I will be looking
Why not instead use some code like this.
function __construct( ) {
if (!in_array('Category', $this-uses)) {
$this-uses[] = 'Category';
}
parent::__construct();
}
I think the problem might be that the Category is getting double
defined, or not defined
I agree I think the best practice is to set pertinent Session variables
at the time when they login. Otherwise, you are going to bog down with
excessive SQL requests to get that information again and again for
every view.
--~--~-~--~~~---~--~~
You received this
I don't see the benefit of the extra roundtrip via the webserver?
Isn't it more clear to have a cronjob execute a script directly
instead of redirecting it through the webserver and an extra
controller? Moreover, your ISP could impose limits on maximum
execution time. Batch processing may
okay i like that. it's not super-clean like i hoped it would be, but
it certainly does the job really well and simple.
I don't really understand how you come up witht he code you wrote,
especially the row thing,
anyway, you bumped me in the right direction, and now i just use this
for the 2nd
Also saw this cool javascript date entry tool today.
http://datebocks.inimit.com/
Sam D
On 9/13/06, Samuel DeVore [EMAIL PROTECTED] wrote:
you might look at some of the date parsing tools in php,
like
http://php.net/strtotime
but to be honest, I tend to either split out the fields for
Hi all. Took my first attempt at building a custom helper. It outputs a
series of radio buttons in a UL list, with each radio having an
associated LABEL.
code
function radio($fieldName, $options, $inbetween = null,
$htmlAttributes = array(), $return = false) {
Initially I had problems with security set to high, but that was in RC
and before versions. Ever since v1 has been officially released I
haven't had any problems with the high setting.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to
You know I wish we could brainwash people into not using IE. People
even try and create viruses only for it and people still continue to
use it. If I created a virus it would destroy IE, install Firefox and
set it as default browser. Then, it would spread to everything it
could doing the same.
One thing I noticed is the use of an $i variable there. Looks like
maybe you are doing a for loop?? That is probably making a lot of
$news[$i]['Reply']['etc'] variables in your code block. Instead using
the foreach ($news as $row) would make them $row['Reply']['etc'] and
clean up your code a
Copy your whole controller into CakeBin http://cakephp.org/pastes
And then paste the link to it in here to examine it more. And it could
be possible that another call is indeed running it, but you only see
the SQL of the current displayed controller and not other ones that
might have been
I develop on my laptop and get 1.3 second renderings. You could also
paste your code to CakeBin for people to take a look at and see if
there is a way to optimize it.
http://cakephp.org/pastes
--~--~-~--~~~---~--~~
You received this message because you are
Also you can just do
$this-Airport-findAllByCity($this-data[Airtravelcalculator][city_input])
and then return stuff.
In a controller method I don't find myself using requestaction much at
all. I instead use the Models methods (findBy, findAll, etc.) to get
any data I need in a specific view.
I
mht wrote:
For couple of days I try to implement Cake ACL. Yes the documentation
lack of easy how to for ACL, different with the rest of others docs,
and I already search within this list to find how to. In the end, with
material from I find, I can implement User and ACL management within my
oh, right, i used for loops there for a good reason in the past (i
needed to know exactly the index of the array), but now i don't need it
anymore. gonna change it to foreach ;)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the
The way in which you would implement it does depend on what kind of jobs you need to run.Just like how there is no one true backup solution that fits everyone's needs or every situation.Having it all based out of a cron_controller would allow you to build an administration interface for it within
If you will be using othAuth, you can just add something like this to
your default view:
Welcome, ?php echo $othAuth-user('firstname').
.$othAuth-user('lastname'); ?!
In this way, you only have to include that line of code once and it
will be shown in all pages.
Likewise, you can set your own
Nate that's pretty interesting. I'm glad to see that there is a way of
using multiple databases with an application.
When you were talking about this;
// Run a query
$this-Model-findAll(...);
// Switch to a different database connection
$this-Model-setDataSource(other_connection);
// Run another
Hello,
A developer found that you can call some action methods in controller.php directly.
http://www.1x1.jp/blog/2006/09/cakephp_controller_action.html
(Japanese Blog)
For example,
if you request a following URL:
http://cake_url/controller_name/flash/any_strings_you_want_to_display/5000
My application requires that in order for orders to be visible in the
future albums never can really get deleted, but their status is set
to inactive. Also, anywhere in my code where I execute a findAll I add
Album.active = 1. This way I don't get the inactive ones.
So, yes there are cases
On Wed, 2006-09-13 at 20:44 +, kabturek wrote:
mht wrote:
For couple of days I try to implement Cake ACL. Yes the documentation
lack of easy how to for ACL, different with the rest of others docs,
and I already search within this list to find how to. In the end, with
material from
Something in 1.2 that looks to be exciting to use a new form helper.
How about one where you can always pass it the
$data['ModelName']['field'] and if that value is null then it just does
a blank. I think the HTML helper now doesn't do this.
I am trying to use pagination as described in this wiki here:
http://wiki.cakephp.org/tutorials:pagination
It works fine, the only problem is that I am trying to use it on a
search form for my web app.
My view has a form, and my controller creates a custom query based on
the values entered on
I just started playing with Cake and there must be something wrong
going...
I am using:
PHP IDE (v0.2.3)
XAMPP 1.5.4
PHP 5.1.6
and Zend Platform 2.2.1a (for server debugging)
This works fine with other projects but whenever I try to run or debug
a cake project, the apache process crashes with:
I usually either encode it in another searchArg element in the view
links or I use a session variable to track it
On 9/13/06, Gregory Stewart [EMAIL PROTECTED] wrote:
I am trying to use pagination as described in this wiki here:
http://wiki.cakephp.org/tutorials:pagination
It works fine,
[EMAIL PROTECTED] írta:
Why not instead use some code like this.
function __construct( ) {
if (!in_array('Category', $this-uses)) {
$this-uses[] = 'Category';
}
parent::__construct();
}
I think the problem might be that the Category is getting
63 matches
Mail list logo