Re: newbie question - multiple functions in a page

2007-12-03 Thread maschoen


I'm fairly new to Cake too, so maybe I will hit something helpful
here.
The tutorial examples tend to make it look like 1 controller for 1
model
and 1 model for 1 controller.

This is not at all true.   A controller can also use many models or
even none.
I think of a controller as the organization of a page, just as a view
is its presentation.
A model set up to CHUD on one model has been a rarity for me except
for administration.

You can use controller's to render just a piece of the page using
requestAction.
The reason this is frowned upon is the idea that it exercises the
whole Cake mechanism, which maybe time consuming.
I'm not really sure if this is true or not, and I've not seen anyone
posting any statistics backing this up.
I agree that it intuitively feels correct, but as a 'C' programmer, my
initial intuition about PHP was, how was it going to get off the
ground? So intuition on a Gigahertz CPU is not always very accurate.

Elements do however seem to fill the bill as reusable mini-controllers
for rendering parts of the 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?hl=en
-~--~~~~--~~--~--~---



Re: HTTPS

2007-11-27 Thread maschoen

Your question needs a little more information to get any kind of
useful answer.   Is this css in a separate style sheet, or embedded
directly in the view.  Did you put the sytel sheet in the webroot/css
directory or elsewhere?  Are you using a helper?  How are you
referencing the filename.  Etc. etc.

On Nov 27, 12:12 am, wowwildcat <[EMAIL PROTECTED]> wrote:
> I try to run cake onhttps://localhost/cake/but the css didn't shows
> up. Any idea?
--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: ajaxHelper::observeField - observes text field onBlur, not onChange

2007-11-18 Thread maschoen

My recent experience is that you want to trigger on the upkey event.
Ignore the event structure itself.   Go to the field and read its
value.
If you look on the downkey, the value hasn't been updated yet.

On Nov 17, 6:03 am, senser <[EMAIL PROTECTED]> wrote:
> I can't understand why every time I start a new discussion here
> (writing the first post) the post is submiited twice. That happens
> every time and I press "Submit" button just once ..
>
> On Nov 17, 1:00 pm, senser <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> > I have a form where users must select from over 11000 records in
> > list_box. I'm using ajax to observe text field and update select to
> > reduce high load when loading page (If I populate list box with 11K
> > records page renders very slow).
> > So the problem is that $ajax->observeField() triggers not on typing in
> > text field, but when the field lost focus. In other words - it works
> > on javascript "onBlur" event, not on "onChange".
> > Is there a way to populate my list_box when user is typing in text_box
> > and is not necessary to press TAB, or to click somewhere with mouse .
> > Here is snippet from my view (I don't think there is a problem in
> > controller or model code, because if the text_field lost focus all is
> > fine and working)
>
> > print $form->input('Employer.string', array('type'=>'text',
> > 'maxlength'=>'5', 'size'=>'10', 'id'=>'employer_string',
> > 'label'=>'Employer'));
>
> > print ' > span>';
>
> > print $form->input('CustomerTaxDetail.employer_id',
> > array('type'=>'select', 'label'=>'', 'options'=>$employersArray,
> > 'showEmpty'=>false, 'size'=>4,
> > 'id'=>'employers',   
> > 'error'=>array('required'=>'Employer is
> > obligatory', 'maxlength'=>'Employer code max length is 8 symbols',
> > 'number'=>'Employer code must be a number')));
>
> > print $ajax->observeField('employer_string', array('url'=>'/employers/
> > autocomplete', 'update'=>'employers', 'indicator'=>'ajax_indicator',
> > 'onChange'=>true));
>
> > P.S. Even when I write something like this:
> > print $form->input('Employer.string', array('type'=>'text',
> > 'maxlength'=>'5', 'size'=>'10', 'id'=>'employer_string',
> > 'label'=>'Employer', 'onChange'=>'window.alert(\'CHANGE\')'));
> > nothing happens when typing in text box
--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: String concatenation not working

2007-11-13 Thread maschoen

I know this might sound a little obvious, but what would you say the
size of your database is in bytes of text?
I only ask because if for example, your database had 100Gig, you
certainly would not expect this to work, would you?
It would seem that for a website that can be hosted for $11/month that
the operation aught to work, however I don't have an experience with
what kind of room PHP or probably mod_php gives you.


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Taking advantage of Cake to build personal book database

2007-11-11 Thread maschoen

btw,

When a book is reissued, it gets a new ISBN.  I think just the
last digit changes.


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: $form->checkbox having troubles.

2007-11-08 Thread maschoen

I've figured out what the strange hidden inputs are about.   The only
big issue I have is why type="checkbox" is repeated.
This might not seem like a big problem, but I sometimes have to run
the generated HTML through an XML parser.   This is a first step to
converting it to a JSON string to return an XMLHTTP request.   The
problem is that the XML parser barfs on the duplicate attribute.
It's very picky.

Anyone know why the duplicate type= or how to stop it?

Thanks again


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: How delete selected checkboxes?

2007-11-08 Thread maschoen

I'm not sure, but I think you might be asking how to have the products
deleted immediately when you check the box?
There are two aspects to this process.
1) Deleting the product record from a database on the host
2) Deleting the entry on the screen

For 1) you will need to somehow put an onClick handler on each
checkbox Input.
You can do this directly in your view, but you will need to also have
the handler javascript accessed by your page.
You can also do this with some startup javascript code.
Once you are in the handler, there are two approaches.
First you could 'submit' the form yourself to the page controller.
This controller would do the database delete, and refresh the entire
page.
This might be a little disconcerting as well as time consuming for the
user if they have to delete a number of products.
After each check they would need to wait for the refresh.
An alternative is to use the xmlhttp object (aka Ajax).
To do this, you would send a product ID to a special controller.
The controller would delete the product, and send some kind of
confirmation message back.
This all requires some fancy javascript, but there is plenty of
documentation around, and plenty of libraries that will help you.

2) If each delete above causes a page refresh, then there is nothing
to do here.  The refreshed page will appear without the deleted
product.
If you are taking the Ajax route, you have two choices.   Delete the
product entry when you send the delete request, or when the result
comes back.
In either case, it is a matter of manipulating the DOM structures to
remove the product from your page.   If you have questions about how
to do this, or integrating it into Cake, you are welcome to email me
directly.   Most of this really is not a Cake matter.


On Nov 7, 4:34 pm, dandreta <[EMAIL PROTECTED]> wrote:
> Hello!
> I have in my view a list of products, each one with a checkbox to the
> side and a link (Remove Selected Products) at the end of the page. The
> question is that I want that on click the link all the marked products
> will be removed. How I would do my function in the controller in order
> that it receives the ids of the marked products  and remove them into
> the database?
> Do you know any article or link relating to this?
> I am inexpert in cakephp and my verion of cake is 1.2.
> Thanks and regards.


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



$form->checkbox having troubles.

2007-11-07 Thread maschoen

I'm using version 1.2.0.5427alpha, and I'm seeing very weird output
from $form->checkbox().

My code looks like:

$name="Model.field';
echo $form->checkbox($name,array('label'=>false,'div'=>false,'value'=>
$somevalue);

The output is something like:




I don't know where to begin with this.   Why is there a hidden 
being output.   Why is a  inserted even though I think I've asked
it not to.   This worked on $form->input().   And then there's those
'label=""' and 'div=''' attributes?   Clearly I'm doing something
wrong.

Thanks for any help.


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Cakephp newbie design question

2007-11-07 Thread maschoen

Not sure if I understand the question, but I think you want to keep
track of the user being logged in, in a Session variable.   That way,
when you build the "tab" pages, you know whether to put up Generic or
Specific content.I would put the navigation tabs in an element and
pass it a variable to indicate which tab is out front.

On Nov 6, 11:17 am, thathu <[EMAIL PROTECTED]> wrote:
> Hello Cakephp developers
>
> I am trying to design a website for my friend using cakephp, but I am not
> sure how to organize the webpages. Here is my design.
>
> User -> Generic page layout -> Generic navigation tabs ->click -> Each tab
> has Generic content for all users
> User - > login -> Generic Page layout -> Generic Navigation Tabs -> Each tab
> with Specific content
>
> I tried using a header.thtml file for the generic tabs and included it in
> the default.thtml in layout folder. How do I design the tabs so that I will
> be going to default page all the time but have different data every time?
> I am having trouble with this design. I tried using separate layout thtml
> for each tab entry, but its very messy. Is there a place to find design
> examples?
> --
> View this message in 
> context:http://www.nabble.com/Cakephp-newbie-design-question-tf4759847.html#a...
> Sent from the CakePHP mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Building a Mailing list app

2007-10-21 Thread maschoen



> this is for my friends nightclub in Bristol (uk)www.clockworkclub.com
> - they've had nearly 1000 people sign up now, and my little cake only
> solution just isn't cutting it any more, it's not for spam, I promise!

A lot of mail these days will be marked spam, put in the spam box, or
not delivered at all if it goes out in large batches.
You might need to experiment with different batch sizes to see if you
are having trouble getting through.
There are related problems to think of too.   My (small) ISP had a cow
when some people at AOL marked as spam my roommates music mailing
list.   He was seriously worried that AOL would start blocking all of
his email.   Likewise, there are a lot of IP blacklists around, and if
you get on one, it can be difficult to get off.   Make sure you give
your customers an unsubscribe tab, and make it easy as possible.


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Ajax request from an external web site to a controller action in a cakephp web site

2007-10-18 Thread maschoen

The Cake View returned could be an HTML snippet that is inserted with
the innerHTML() method.


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Simple authentication for directory??

2007-10-18 Thread maschoen

Instead of  replace SRC with
"get_picture.php/1".   get_picture.php checks whether the user is
logged in and if so uses the following PHP code to return the picture.

$fileno = $_SERVER['QUERY_STRING'];
$filename = "/picture/directory/not-below-webroot/PICTURE" . $fileno .
".jpg";
$image = imagecreatefromjpeg($filename);
if ($image == null)
{
return;
}
header("content-type: image/jpeg");
imagejpeg($image);
imagedestroy($image);

This requires that PHP be configured with the gd library.   I'm not
sure if that is common or not.


On Oct 17, 7:23 am, Jacob83 <[EMAIL PROTECTED]> wrote:
> Nobody knows about a solution for this problem?
> I think it's a very common question, isn't it?
>
> On 6 Okt., 07:58, Jacob83 <[EMAIL PROTECTED]> wrote:
>
> > Hi out there,
> > is there any way to limit access to a directory to logged in users
> > only? i.e. i don't want everybody to be able to see my pictures/
> > documents by simply entering the url.
> > I think I'll have to use a php file which flushes the file ... (bad
> > performance??)
> > but perhaps someone has already written something like this...
> > Regards,
> > Jacob


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Programming with controllers

2007-10-17 Thread maschoen

> Perhaps the ´flash´ message would be appropriate?

Thanks for the suggestion, but I don't think you understand the
issue.   Which controller would I issue the flash message from?
The login controller is where it needs to go, but doesn't know what
the error message is.   The main controller knows the what the error
message is, but issuing the flash message request from it would not
put it where the html is rendered.


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Programming with controllers

2007-10-16 Thread maschoen

I'm new to Cakephp and there's a situation that I'm not sure how to
deal with.
In a controller for some page and I do some custom validation on form
input, for example I see if login-id/password are valid.  If the
validation fails, the controller generates an error message for
display in the login section of the page.
Since the same login is used on every page, it is generated with its
own separate controller.  The html is generated by calling the login
controller with the requestAction method.

The question is how to get the error message to the login controller
for rendering?
I could send it as a parameter in requestAction, but this would
require encoding and decoding it so spaces are not a problem.
I can also use a global variable, but this seems to violate the spirit
of MVC and clean programming in general.

Is there a more straight forward way to do this?


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---