I don't have time to work out all the details of the syntax right now,
however this is how I might approach it:

// Loop through the ascii values for capital A-Z;
// And make output a link for each letter
// Do this in your view
for ($i = 65; $i < 90; $i++) {
    // chr() documentation - http://us.php.net/manual/en/function.chr.php
    echo $html->link(chr($i), array('action' => 'letter_find',
chr($i))) , ' - ';
    // This should output the links like this: A - B - C - D - ...
}

Now in your controller, the action letter_find() is going to get
called and the letter of interest will be available in the params
property (http://book.cakephp.org/view/949/Passing-parameters-to-
action). If my memory of thins is correct, you should be able to get
to it like this:

$letter = $this->params['pass'][0];

Your can take a look at this useful property for yourself by putting
this in your action:

debug($this->params); die;

At any rate, you now have the value the user clicked on and you can
write your find with a regular expression condition to find the proper
records. I can't do that off the top of my head and I don't have time
right now to experiment to get it right. But this, and the earlier
link to writing conditions should help?

Regards,
Don


On May 10, 7:59 am, MeatSandwich <[email protected]>
wrote:
> Hey, thanks for the response.
>
> I'm reading through the link you sent me but I'm a total neub (not all
> that familiar with php either!) so having a bit of trouble making
> sense of what exactly I'm meant to be doing.
>
> I'm I meant to create a link for each letter and then do a query each
> time someone clicks the link?
>
> If you fancied explaining it is a bit more detail, as if you're
> talking to a moron (you are) I'd really appreciate it! :)
>
> On May 10, 3:04 pm, dreamingmind <[email protected]> wrote:
>
>
>
>
>
>
>
> > Cake will accept regular expressions in your find conditions. That
> > should make your task pretty easy... as easy as writing regular
> > expressions :-)
>
> >http://book.cakephp.org/view/1017/Retrieving-Your-Data#Complex-Find-C...
>
> > Regards,
> > Don
>
> > On May 10, 6:57 am, MeatSandwich <[email protected]>
> > wrote:
>
> > > I have a table which holds the names of loads of charities in the UK.
>
> > > I want to have a page which will allow users to search through these
> > > charities but there's 1000s of them. I'd like to be able to have the
> > > alphabet written out A, B, C and so on with each letter a link to all
> > > the charities beginning with that letter.
>
> > > Whats the best way to go about doing that using cakephp?

-- 
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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to