Re: basic website with cake.

2006-09-05 Thread AD7six

Hi atmorell,

do you mean a CMS (that anybody can use) or you mean you (as a
developer) want to be able to manage the content?

Assuming the latter I would suggest handling things seperately, and as
such the tasks become much smaller

[EMAIL PROTECTED] wrote:

 Text and images should be stored in the database. Does anyone have a
 clue about how I should approach this?

Storing the text in a database, would just mean something that is (in
princple) very similar to the blog tutorial.
Storing images in the database is quite easy, if you generate the links
for your images in the form a
href='/MyImageControllerName/Display/ImageID / then if you create an
image controller, with a function display, that reads from the db the
image with the id ImageID, outputs the correct headers and dumps the
image data - that´s that task completed. 'MyImageControllerName' can
be anything, you could call it ImgController and for any file that
isn´t in your root /img/ folder, this controller would be triggered.

 I am thinking about creating a login form  - if a user has validated I will 
 display a
 modify/delete bottom below each element (text/image) - this logic will be 
 placed in
 each view!! (are this ok?) There will only be one admin user.

Acccess control would just mean (for example) setting a session
variable when someone logs in, and checking for this session variable
to display 'admin' content. You should also put a check in the
beforeFilter of your controller (or app controller if you want acl site
wide in one call) so that should anyone guess the right url they don't
get access to something they shouldn't. you could do something like
if ($Session['MemberLoggedIn']) {
$this-renderElement(AdminActions); }
In your view/layout to keep the views simple and the logic easily
seperable.

 So far I have created the following controllers:

 ccases  (customer cases),
 ccases_pictures (ccase_id, file_id)
 text (all text, e.g. about us, contact, description etc),
 files,

Assuming that you mean a CMS for a single site, you don´t need a text
controller, there is an inbuilt one named pages that is used to
display static content. It isn´t too difficult to create a controller
to edit your static pages, should that be required. A contact form
requires a form target and as such it´s best to give it it's own
controller.

 How do I put all this together? Should I create a page controller with
 one action for each tab? (forside, om-os, det-kan-vi, cases, kontakt)
 (translated: home, about-us, skills, cases, contact)

If you pages are static in nature (dont require controller logic) use
the pages controller. You can use routes such that /forside is
understood by cake to mean /pages/display/home.

I hope this helps answer some of your questions,

Cheers,

AD7six


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Route problem. How to ignore the action name?

2006-09-05 Thread nate

This one should work:
$Route-connect('/tags/*, array('controller' = tags, 'action' =
'view'));

Then, in your action, you pick up the tag name as a parameter:

function view ($tagName = null) {
// 
}


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: IMPORTANT CakePHP Security Fix

2006-09-05 Thread nate

Even in such cases, I doubt your problem is serious enough to warrant
trying to break out of a decades-old software design paradigm for one
exception; and if that is the case, you should take a step back and
re-think the way in which you're designing that part of the application.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Total NOOB-- Defualt.thtml

2006-09-05 Thread Chris

Hello,

I am creating a website
http://www.findgoodschools.com/schoolsearch/state/oregon/
http://www.findgoodschools.com/schoolsearch/state/washington/
and got 20% finished when I decided to give cake a try. and it looks
really nice,  but I am having trouble wrapping my head around the
frame work.

First couple of question,  that I have not been able to answer from
looking at the docs and the sample Blog App

1. I see that the defualt.thtml has:
titleCakePHP: ?php echo $title_for_layout;?/title
it apears that $title_for_yourlout is assigned by $name in the
controller,  How do I dynamicly change the title?  If they are on
Oregon schools I want it to display Oregon bla da bla...

2. My meta tags I want to change dynamicly,  how?

3. My menu is the same on every page however the classes change to show
the active menu,  how do I pass that information to the default.thtml?

4. My javascript needs change on a page by page basis and would like to
contain all js files before the /head how do I dynamicly ad js to the
template file?

Like I said total NOOB here... 

many thanks
Chris


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Multiple Databases

2006-09-05 Thread [EMAIL PROTECTED]

i'm studying cakephp and i found some problems with this method of
dev.

Can i connect in multiple MSSQL server with the same Model ?
something in app/config/databases.php ?

I'm very confused about this... someone can help me, please ?

tkns


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Total NOOB-- Defualt.thtml

2006-09-05 Thread nate

$title_for_layout and $content_for_layout (and $scripts_for_layout as
of Cake 1.2) are magic variables assigned by the View class.  You can
override the default by setting $this-pageTitle in either the
Controller (inside one of your actions), or in your view template.

As to your other questions, you can use the set() method of the
controller to pass data that will be available in both your layout and
your view template.  This might be a good place to set meta tag data,
depending on your situation.  If you checkout Cake 1.2 from SVN
(https://trac.cakephp.org/browser/branches/1.2.x.x), you can also use
$this-set() in your view templates, to pass data to your layout, and
$javascript-link supports a second parameter which will allow you to
send JavaScript links to the head / (or wherever in your layout you
put $scripts_for_layout).


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Multiple Databases

2006-09-05 Thread nate

Cake allows you to connect to an unlimited number of databases in a
single application session/request.  To change the target of one
database connection you can do the following:

$db = ConnectionManager::getDataSource(default); // Get a reference
to the default database
$db-reconnect(array(database = new_db, host' =
192.168.168.99)); // Connect to a different database on a different
server

You can also use multiple database connections in parallel, and
dynamically switch which one a model is connected to:

$this-Model-findAll(...); // Run a query
$this-Model-setDataSource(other_connection); // Switch to a
different database connection
$this-Model-findAll(...); // Run another query
$this-Model-setDataSource(default); // Switch back to the original
database connection

You can add additional database connections by copying the $default
variable in /app/config/database.php and renaming it.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Composit forms for composit models

2006-09-05 Thread Sonic Baker
Hi Stuart,

I had a similar problem. You can get the required behavior by making your own HTML helper.

HTH,

Sonic

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake PHP group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Creating database tables within an application

2006-09-05 Thread gorbster

Is it possible to dynamically create tables from within a Cake
application, and then use the table with Cake's Model class?

Thanks,

-Brian


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Creating database tables within an application

2006-09-05 Thread nate

You can if you intercept the __construct( ) method of the controller
(or AppController), i.e.:

function __construct( ) {
$db = ConnectionManager::getDataSource(default); // Get database
connection reference
$db-execute(CREATE TABLE ...);
parent::__construct();
}


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Creating database tables within an application

2006-09-05 Thread John David Anderson (_psychic_)


On Sep 5, 2006, at 10:11 AM, gorbster wrote:


 Is it possible to dynamically create tables from within a Cake
 application, and then use the table with Cake's Model class?

Make a generic model that doesn't use a table (var $useTable =  
false), and use the execute() function of the model to create your  
new table.

Something like $this-ModelName-execute('CREATE TABLE IF NOT EXISTS  
foo');

-- John

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: IMPORTANT CakePHP Security Fix

2006-09-05 Thread calzone

I think you guys have missed the actual point of my post, which is that
I don't see any documentation regarding the lack of controller access
in the view, especially as it concerns people who have been using
$this-controller-Session in their views out of necessity from the
previous version.

I'm perfectly happy to take my own responsibility for circumventing
decades old design paradigms imposed by Cake if I feel my situation
warrants it.  However, it was neither previously imposed, nor do I
don't think it's realistic/safe to assume that none of us out here are
using any or all available session methods in a view. It would be nice
to warn us about these things before telling us it's imperative to
update our code with a new version.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



mod_rewrite and %26 (urlencoded )

2006-09-05 Thread [EMAIL PROTECTED]

I've noticed some odd behavior when trying to use the CakePHP
mod_rewrite rules and urls with %26 in them. When 'RewriteRule ^(.*)$
index.php?url=$1 [QSA,L]' is used to parse a url with %26, it's
converted to an .

For example, if you setup a route for /candy/* =
CandyController::find() and goto /candy/M%26M it's rewritten as
index.php?url=MM. PHP sees this as array('url' = 'M', 'M' = null).

I thought this was an obvious mistake on my part with setting up
mod_rewrite or the .htaccess file, but I didn't find any documentation
of this restriction. Is there some kind of mod_rewrite setting to
disable this behavior? Or is this a known limitation of CakePHP and
developers simply never pass any characters via the URL that aren't
urlencoded?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: IMPORTANT CakePHP Security Fix

2006-09-05 Thread nate


calzone wrote:
 I think you guys have missed the actual point of my post, which is that
 I don't see any documentation regarding the lack of controller access
 in the view, especially as it concerns people who have been using
 $this-controller-Session in their views out of necessity from the
 previous version.

http://cakeforge.org/forum/forum.php?forum_id=255

It's right in the release announcement.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: open_basedir restriction in effect Help Needed

2006-09-05 Thread Sebastian Macias

Thanks Matt.

I tried what you recommended and many other alternatives I found on
discussion boards but unfortunately I have Plesk installed on my server
so whatever I do to any config files would be overwritten within
seconds by Plesk.

Fortunately a friend actually got it working for me using a different
approach. What he did was he added 'false' to the if statement that
checks if the ini_set function exists in the webroot/index.php file.
That way Cake uses the absolute path when loading is libraries and
doesn't depend on the include_path.

If anybody using Plesk is expereincing the same issue find this line in
webroot/index.php:

 if (function_exists('ini_set')) {

and replace it with:

 if (false  function_exists('ini_set')) {

Thanks worked out perfectly for me.

Thanks,

Sebastian

Matt Puchlerz wrote:
 Judging by the path, I'm thinking you might be hosted on Media Temple.
 If that's the case, here's how I fixed my open_basedir problem...

 Log into the shell.  Within your site's domain folder
 (/var/www/vhosts/begreennow.com/) is another folder called conf.
 Inside that folder is a file called httpd.include.  Use a text editor
 to open that file (I used vi).  Once inside that file, you'll see
 Apache configurations for your begreennow.com domain, as well as any
 subdomains you might have for it.  There should be a line that says...

 php_admin_value open_basedir
 /var/www/vhosts/begreennow.comBLAHBLAHBLAH

 Comment out that line by putting a # at the beginning of it, and save
 the file.  Make sure that you then reboot your server, and hopefully
 the problem will disappear.

 I don't really now why that setting exists, but it does.  Hope this
 might have helped.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Composit forms for composit models

2006-09-05 Thread Sohei Okamoto
>From what I understand,
HTML helper explodes the input name by slash, and takes the first one as model and second one as field name. The rest of the name is ignored.
Then make the onput tag by
input name=data[%s][%s] %s/
where first %s is model name, second is field name, and the last one is the rest of attributes.

I've seen and used the hack to do exactly what you want to do by using the name as 'Person/Address][address1'This makes the field name as Address][address1 and the name in output tag would be data[Person][Address][address1]

Also, you can fix the setFormTag function in HTML helper by this person's patch
https://trac.cakephp.org/ticket/945

Still, HTML helper will make id as something like Person[Address][Address1, so you still might want to specify it, or make a new helper.Hope this helps.Sohei

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake PHP group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Re: IMPORTANT CakePHP Security Fix

2006-09-05 Thread calzone

I don't mean to beat a dead horse, but, no, it's not there.  That says
nothing that isn't already contained in this thread.

Please take my words as constructive criticism and understand that cake
users are not mind readers.   Meanwhile, the manual continues to refer
to the session component with no mention of the helper. And nowhere is
it documented what methods and properties are available with this new
helper or is there a warning to people out there who may be using any
and all methods and properties in their views.

A security fix is always a good thing, but bundling it with changes
that can break existing installations without warning people how that
might happen is not fun.

It is recommended that everyone upgrade and change all references to
$this-controller-Session in the view to the new helper, $session.

That won't work if someone is using an unsupported sesssion method in
the view.  In fact, the announcement doesn't even mention that any kind
of access to the session component from a view is totally unsupported
now. Instead, it hints at a future day when that will be the case and
that it's recommended to start migrating code over.  A typical user
sees that and thinks, 'hey, security update, I need to do this.'

I really am not trying to be argumentative, and perhaps I'm nitpicking;
my case is not a big deal. But then, this wouldn't have consumed so
many back and forth posts if my initial valid point had not just been
dismissed out-of-hand without a second thought.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



query and group by

2006-09-05 Thread Ámon Tamás

Hello,

I try the next query:

SELECT workers.nev, worker_id, item_id, sum(pays.amount) as amount
   FROM pays, workers
   WHERE workers.id=pays.worker_id and year ={$syear} AND 
year={$eyear} AND month={$smonth} AND month={$emonth} and item_id in 
(.join(', ', $ids).)
   GROUP by worker_id, item_id

But when I retrieving the data I get an array something like this:

[5] = Array
 (
 [workers] = Array
 (
 [nev] = Ámon Tamás
 )

 [pays] = Array
 (
 [worker_id] = 5
 [item_id] = 6
 )

 [#sql_ae6_0] = Array
 (
 [amount] = 0
 )

 )

The problem is the last sub-array with #sql_ae6_0. And this is always 
changing. How can I retrieve datas from it?

-- 
Ámon Tamás
http://amon.hu


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Total NOOB-- Defualt.thtml

2006-09-05 Thread MrTufty

Nate,

I'm probably doing something stupid, but I find myself unable to
checkout from SVN. Is there a set of instructions on how to do it? I
have TortoiseSVN installed already and I've had it working in the past,
just not with Cake...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Total NOOB-- Defualt.thtml

2006-09-05 Thread nate

Sorry, I probably should have been more clear.  The URL I posted was
the web-based SVN browser.  To actually check it out with an SVN
client, use this: https://svn.cakephp.org/repo/branches/1.2.x.x/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Does anyone know how to handle carriage returns from user input

2006-09-05 Thread nate

This is going to be your best friend:
http://regularexpressions.info/quickstart.html

When doing regular expressions, you can use \n to match newlines, or \s
to match any spacing character.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Route problem. How to ignore the action name?

2006-09-05 Thread Fasthold

Thanks nate.
Yes, this works for view action. But it doesn't work for add action any
more,
When I visit http://localhost/tags/add, it also redirect to view page.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Route problem. How to ignore the action name?

2006-09-05 Thread Bert Van den Brande

Make sure you define the /tags/add route before the general /tags/*
route in routings.php

On 9/6/06, Fasthold [EMAIL PROTECTED] wrote:

 Thanks nate.
 Yes, this works for view action. But it doesn't work for add action any
 more,
 When I visit http://localhost/tags/add, it also redirect to view page.


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Route problem. How to ignore the action name?

2006-09-05 Thread nate

Right, you need to hard-code a route for each action.  I'm actually
working on some Router enhancements that'll make this process a little
easier.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Route problem. How to ignore the action name?

2006-09-05 Thread Fasthold


Bert Van den Brande 写道:

 Make sure you define the /tags/add route before the general /tags/*
 route in routings.php


Yes, this works with
$Route-connect('/tags/add', array('controller' = 'tags', 'action' =
'add'));
and
$Route-connect('/tags/*', array('controller' = 'tags', 'action' =
'view'));
all added.

But in this case, as long as I add a new controller action, I have to
add a new rule to the routing config file. Is there any possible to
specify the rule like this $Route-connect('/tags/:firstparam',
array('controller' = 'tags', 'action' = 'view','firstparam')); ?
 I hope this in future cake. :)

Thanks.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---