Excerpt of just first result from foreach

2011-12-22 Thread Mr.Jayesh
Hello Everyone,
Hope thing are baking great

I require an input from you people, so I can get in with this.
See, I am making a blog like layout for which I have planned to give
out a list of 10 recent post in my main page.
Now, out of that 10, I wanted to show an excerpt of the first one,
followed by 9 title links.

Here, am confused how shall I code to get that.
Is there any alternate to foreach or it can be coded in foreach
either.

Anyways, all your inputs matters me a lot.

Regards,
Jayesh

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


What is the way to make Sub Pages

2011-06-01 Thread Mr.Jayesh
Hi Mates,

Am working on a project on which I require your advice.
I am thinking to split a row data to couple of pages. For example:

Main landing page for row data:
www.example.com/datas/data-title (currently this page displays full
data from particular row)

What I want looking for is:
www.example.com/datas/data-title (would contain intro texts)
www.example.com/datas/data-title/about-this (some more data from same
row.)

So, would invite your advice and input on this.

Thanks in Advance.

Happy Baking

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


Any way to pass multiple order string to Pagination

2011-04-28 Thread Mr.Jayesh
Hi Mates,

Am stuck at place where am not able to pass multiple order strings to
pagination. I am using pagination and have done this in my controller:

var $paginate = array(
'limit' => 15,
'order' => array(
'Model.field' => 'desc',
'Model.field' => 'desc')
);

But the results is just working the first string and ignoring the
second one.

Please, anyone guide me, I think have mistaken somewhere. Am unable to
get solution for this.

Regards.

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


How to make Groups in Multiple Select box

2011-04-20 Thread Mr.Jayesh
Hi Mates,
Hope baking is in full swing.

I am coding a multi select box for categories. I am using Tree
Behavior for categories.
The thing I am up to is I don't want to allow users to select top
categories in the list. I mean the category is displayed as an
hierarchy, but I dont want the users to choose the top categories
(whose parent_id is 0) for posting an article.

May please anyone advice.

Regards,
Jayesh

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


Any Solution to Order a generatetreelist output

2011-04-16 Thread Mr.Jayesh
Hi Mates,

First off all, I would like to thank this group for being of great
support.
Guys, as in my project I was trying to display category list inside
select box. I am using Tree List, so what I have in my table is:
|  id  |  category  |  parent_id  |
Currently I am using generatetreelist() that generates a good
hierarchy of categories, but these are not in proper order.

I mean, I wanted to order it according to category field. I tried many
ways but didn't got the result, even later got confused while
searching for a solution.

May anyone please advice me a simple solution in this regards, would
be thankful.

Regards,
Jayesh

-- 
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 echo Image that was uploaded through MeioUpload

2011-04-13 Thread Mr.Jayesh
I would really like to thank everyone for their valuable input.
See, as per the discussion so long, I would like to make some things
clear. I have a picture column that saves the filename and also a dir
column that saves the directory root. I have set the upload path to
img{DS}tablets. that saves the directory info like " img/tablets "
into the dir column.

I tried various combination, at last finalized with this:
image('..' . DS . 'img' . DS . 'tablets'. DS .
$medicine['Medicine']['picture']); ?>

Now, It works great.

Thanks to All.

Regards,
Jayesh



On Apr 14, 8:46 am, Vitor Pacheco  wrote:
> the default path for the upload is "uploads{DS}{ModelName}{DS}{fieldName}"
> if you do not set another path in the model, or is not being saved in the
> database try using this path echo $this->Html->image('..' . DS . 'uploads'.
> DS. 'model'. DS. 'field' . DS 'file.png');
>
> 2011/4/13 Mr.Jayesh 
>
>
>
>
>
>
>
>
>
> > Hi Mates,
>
> > As while working on my project, I am using meioupload behaviour for
> > handling image upload. I have set it as per the documentation provided
> > in their site. I have four fields: picture, dir, mimetype, filesize.
> > There is no error in uploading. But the problem is, the picture field
> > only stores the file name. I have set a folder under img to store the
> > files. The files get stored correctly into the directory.
>
> > The issue is, how will I be able to echo the image on the view. The
> > echo only states the img/filename.extn . but this will not show
> > the image. How can I configure the meio to store the dir name in the
> > picture column so I can get proper file root.
>
> > Is it something I am doing wrong.
>
> > Regards,
> > Jayesh
>
> > --
> > 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
>
> --
> *Vitor Pacheco*
> *71 8626-7909
> 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


How to echo Image that was uploaded through MeioUpload

2011-04-13 Thread Mr.Jayesh
Hi Mates,

As while working on my project, I am using meioupload behaviour for
handling image upload. I have set it as per the documentation provided
in their site. I have four fields: picture, dir, mimetype, filesize.
There is no error in uploading. But the problem is, the picture field
only stores the file name. I have set a folder under img to store the
files. The files get stored correctly into the directory.

The issue is, how will I be able to echo the image on the view. The
echo only states the img/filename.extn . but this will not show
the image. How can I configure the meio to store the dir name in the
picture column so I can get proper file root.

Is it something I am doing wrong.

Regards,
Jayesh

-- 
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: Strange issue in Single View : Undefined index

2011-04-13 Thread Mr.Jayesh
Hae...

Thanks for the prompt advice.
The Recursive did the trick.

Thanks Again.

Regards,
Jayesh

On Apr 13, 2:15 am, euromark  wrote:
> http://book.cakephp.org/view/1063/recursive
>
> or containable behavior
>
> On 12 Apr., 22:10, "Mr.Jayesh"  wrote:
>
>
>
>
>
>
>
> > Hi Mates,
>
> > As currently I am working on a project of some directory. I am
> > frequently landing up into a strange problem.
> > Initially, when I set up the installation, and start working with
> > models, controllers and views. everything is ok. but the problem arise
> > when I run the single view function. Let me explain with an example:
>
> > I have tables like: Medicine, Manufacturer, Origin, etc.
> > Similarly I have models and controllers. The relations are.
> > manufacturers hasMany medicines; Origin hasMany medicines ; medicines
> > belongsTo manufacturers and origin.
>
> > now I have four functions in my medicine controller:
> > index (which is a search form)
> > search (search function and logic)
> > result (that renders the search result)
> > details (that displays individual details of each post.)
>
> > When I search using form there is no problem, I get the results
> > according with various joins. The results has a link to details view
> > like this:
>
> > function details($id = null) {
> >  //all logic here
>
> > }
>
> > The problem arises here. I am able to land up in correct page.but the
> > view is unable to show me join data. where ever the datas are from
> > other tables like manufacturers and origin and others, it shows a
> > Undefined index like this:
>
> > Notice (8): Undefined index:  Manufacturer [APP/views/medicines/
> > detail.ctp, line 10]
>
> > Notice (8): Undefined index:  Origin [APP/views/medicines/detail.ctp,
> > line 18]
>
> > All other data that is from same table of medicines show correctly.
>
> > May anyone point me in right direction, please. I am totally
> > frustrated in this and messed up. I cant find this solution anywhere
> > over internet. I am using CakePHP 1.3.6 installation.
>
> > I made 4 fresh installation but the results are same.
>
> > Please help.

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


Strange issue in Single View : Undefined index

2011-04-12 Thread Mr.Jayesh
Hi Mates,

As currently I am working on a project of some directory. I am
frequently landing up into a strange problem.
Initially, when I set up the installation, and start working with
models, controllers and views. everything is ok. but the problem arise
when I run the single view function. Let me explain with an example:

I have tables like: Medicine, Manufacturer, Origin, etc.
Similarly I have models and controllers. The relations are.
manufacturers hasMany medicines; Origin hasMany medicines ; medicines
belongsTo manufacturers and origin.

now I have four functions in my medicine controller:
index (which is a search form)
search (search function and logic)
result (that renders the search result)
details (that displays individual details of each post.)

When I search using form there is no problem, I get the results
according with various joins. The results has a link to details view
like this:

function details($id = null) {
 //all logic here
}

The problem arises here. I am able to land up in correct page.but the
view is unable to show me join data. where ever the datas are from
other tables like manufacturers and origin and others, it shows a
Undefined index like this:

Notice (8): Undefined index:  Manufacturer [APP/views/medicines/
detail.ctp, line 10]

Notice (8): Undefined index:  Origin [APP/views/medicines/detail.ctp,
line 18]

All other data that is from same table of medicines show correctly.

May anyone point me in right direction, please. I am totally
frustrated in this and messed up. I cant find this solution anywhere
over internet. I am using CakePHP 1.3.6 installation.

I made 4 fresh installation but the results are same.

Please help.

-- 
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 Configure Search Url...?

2011-03-23 Thread Mr.Jayesh
Thanks for the tip.

But, On integrating this, I am getting an error:
Invalid argument supplied for foreach()

I tries various methods to get it done. But, no success.
Anything else can I try.
Thanks again.

Regards
Jayesh

On Mar 23, 1:05 pm, Tilen Majerle  wrote:
> //try this
>
> function search() {
>
>                $url['action'] = 'index';
>
>                foreach ($this->data['Search'] as $k=>$v){
>                        foreach ($v as $kk=>$vv){
>                                $url[$k.'.'.$kk]=$vv;
>                        }
>                }
>
>                $this->redirect($url, null, true);
>        }
> --
> Lep pozdrav, Tilen Majerlehttp://majerle.eu
>
> 2011/3/23 Mr.Jayesh > function search() {
>
> >                $url['action'] = 'index';
>
> >                foreach ($this->data as $k=>$v){
> >                        foreach ($v as $kk=>$vv){
> >                                $url[$k.'.'.$kk]=$vv;
> >                        }
> >                }
>
> >                $this->redirect($url, null, true);
> >        }

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


How to Configure Search Url...?

2011-03-23 Thread Mr.Jayesh
Ho All,
Hope Baking is at its Peak.

I am using below code from which I am getting url like this:
example.com/cake/posts/index/Search.keywords:mykeyword/Search.tag_id:3

How to configure this, so that I get url like these:
example.com/cake/posts/index/keywords:mykeyword/tag_id:3

function search() {

$url['action'] = 'index';

foreach ($this->data as $k=>$v){
foreach ($v as $kk=>$vv){
$url[$k.'.'.$kk]=$vv;
}
}

$this->redirect($url, null, true);
}

-- 
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 Hide Model name from URL of Search Result Pages

2011-03-19 Thread Mr.Jayesh
Hi Adael; Hi Miles,

I am not very thorough in this regards, I was trying to build a
Advanced search form for my site.
I am using $this->passedArgs. The controller code for this function is
as under:

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

if(isset($this->passedArgs['Medicine.keyword'])) {
$keyword = $this->passedArgs['Medicine.keyword'];
$this->data['Medicine']['keyword'] = $keyword;
$this->set('keyword');
} else {
$keyword = null;
}

if(isset($this->passedArgs['Medicine.author_id'])) {
$author = $this->passedArgs['Medicine.author_id'];
$this->data['Medicine']['author_id'] = $author;
$this->set('author');
} else {
$author = null;
}

if(isset($this->passedArgs['Medicine.field'])) {
$area = $this->passedArgs['Medicine.field'];
$this->data['field']['field'] = $area;
$this->set('area');
} else {
$area = null;
}

$conditions = array(
"Medicine.author_id LIKE" => "%$author%",
"Medicine.field LIKE" => "%$area%",

"or" => array(

"Medicine.name LIKE" => "%$keyword%",
"Medicine.description LIKE" => 
"%$keyword%"
))
;
} else {
$this-
>redirect(array('controller'=>'medicines','action'=>'search'));
}

Please, anyone advice me a direction for getting proper url of search.

Regards,
Jayesh

On Mar 15, 3:45 am, Miles J  wrote:
> What are you using to generate the named params?
>
> On Mar 14, 2:15 pm, Adael  wrote:
>
>
>
>
>
>
>
> > You can do the following:http://pastebin.com/JAup00Hn
>
> > On 14 mar, 20:00, "Mr.Jayesh"  wrote:
>
> > > Hello Everyone,
> > > Hope things Great..
>
> > > Anyone please advice me a quick solution from which i can hide model
> > > name from my URL created out of search string.
>
> > > currently my url looks 
> > > like:http://my.website.com/medical/results/Medicine.search:cancer/Medicine...
>
> > > I wanted it to be like 
> > > this:http://my.website.com/medical/results/search:cancer/author_id:5
>
> > > Thanks in advance.
> > > Regards.

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


How to Hide Model name from URL of Search Result Pages

2011-03-14 Thread Mr.Jayesh
Hello Everyone,
Hope things Great..

Anyone please advice me a quick solution from which i can hide model
name from my URL created out of search string.

currently my url looks like:
http://my.website.com/medical/results/Medicine.search:cancer/Medicine.author_id:5

I wanted it to be like this:
http://my.website.com/medical/results/search:cancer/author_id:5


Thanks in advance.
Regards.

-- 
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: Please help with Optional Search Field

2011-03-10 Thread Mr.Jayesh
Thanks for the response. As advised, I solved this by adding a else
statement to it. now its working well. Another thing, would you please
advice me a quick solution from which i can hide model name from my
URL created out of search string.

currently my url looks like:
http://my.website.com/medical/results/Medicine.search:cancer/Medicine.author_id:5

I wanted it to be like this:
http://my.website.com/medical/results/search:cancer/author_id:5

Thanks again and
Thanks in advance.

Regards.



On Mar 10, 6:16 pm, rethab  wrote:
> What is the exact error message you're facing?
>
> Maybe something like: 'Use of undefined variable'? Some of your
> variables are only set if the if - statements execute. However, you're
> using them later on. Make sure you either initialise them with default
> values or don't use them below.
>
> On 10 Mrz., 12:32, "Mr.Jayesh"  wrote:
>
>
>
>
>
>
>
> > I am in process of creating a search function for my site. It has
> > three search parameters. I have worked it this way.
> > The search functions properly with pagination. The problem is small; I
> > am not able to identify how to setoptionalfield. When a user passes
> > all the parameters for search there is no error message; but if one of
> > those is left blank; I get an error stating "Undefined variable:
> > medicine".
>
> > My controller search function code is as under.
>
> > if (!empty($this->passedArgs)) {
>
> >         if(isset($this->passedArgs['Article.search'])) {
> >         $keyword = $this->passedArgs['Article.search'];
> >                 $this->data['Article']['search'] = $keyword;
> >                 $this->set('keyword');
> >     }
>
> >         if(isset($this->passedArgs['Article.author_id'])) {
> >         $author = $this->passedArgs['Article.author_id'];
> >                 $this->data['Article']['author_id'] = $author;
> >                 $this->set('author');
> >     }
>
> >         if(isset($this->passedArgs['Article.area'])) {
> >         $medicine = $this->passedArgs['Article.medicine'];
> >                 $this->data['Article']['medicine'] = $medicine;
> >                 $this->set('area');
> >     }
>
> >         $conditions = array(
> >                                 "Article.author_id LIKE" => "%$author%",
> >                                 "Article.medicine LIKE" => "%$medicine%",
>
> >                                 "or" => array(
>
> >                                         "Article.medication LIKE" => 
> > "%$keyword%",
> >                                         "Article.description LIKE" => 
> > "%$keyword%"
> >                         ))
> >                 ;
> >         } else {
> >                 
> > $this->redirect(array('controller'=>'Articles','action'=>'search'));
> >     }
> >         $articles = $this->paginate('Article', $conditions);
>
> >         $authors        = $this->Article->Author->find('list', 
> > array('fields' =>
> > array('author_name'),
> >                         'conditions' => array('Author.status_id' => 1)));
> >         $this->set(compact('authors', 'articles'));
>
> >         $this->layout = 'resultlist';
> >         $this->set('title_for_layout', 'Search Result');
>
> >         }
>
> > I think, I am not able to set upoptionalfield properly. So, please
> > help us with your valuable suggestion.
> > Thanks in advance.
>
> > Regards.

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


Please help with Optional Search Field

2011-03-10 Thread Mr.Jayesh
I am in process of creating a search function for my site. It has
three search parameters. I have worked it this way.
The search functions properly with pagination. The problem is small; I
am not able to identify how to set optional field. When a user passes
all the parameters for search there is no error message; but if one of
those is left blank; I get an error stating "Undefined variable:
medicine".

My controller search function code is as under.

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

if(isset($this->passedArgs['Article.search'])) {
$keyword = $this->passedArgs['Article.search'];
$this->data['Article']['search'] = $keyword;
$this->set('keyword');
}

if(isset($this->passedArgs['Article.author_id'])) {
$author = $this->passedArgs['Article.author_id'];
$this->data['Article']['author_id'] = $author;
$this->set('author');
}

if(isset($this->passedArgs['Article.area'])) {
$medicine = $this->passedArgs['Article.medicine'];
$this->data['Article']['medicine'] = $medicine;
$this->set('area');
}

$conditions = array(
"Article.author_id LIKE" => "%$author%",
"Article.medicine LIKE" => "%$medicine%",

"or" => array(

"Article.medication LIKE" => 
"%$keyword%",
"Article.description LIKE" => 
"%$keyword%"
))
;
} else {

$this->redirect(array('controller'=>'Articles','action'=>'search'));
}
$articles = $this->paginate('Article', $conditions);

$authors= $this->Article->Author->find('list', array('fields' =>
array('author_name'),
'conditions' => array('Author.status_id' => 1)));
$this->set(compact('authors', 'articles'));

$this->layout = 'resultlist';
$this->set('title_for_layout', 'Search Result');

}

I think, I am not able to set up optional field properly. So, please
help us with your valuable suggestion.
Thanks in advance.

Regards.

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


Help - HABTM Multi-Select Field

2011-02-24 Thread Mr.Jayesh
Hi everyone,

I am working on a project where I have set up a habtm for Categories.
I am using CakePHP 1.3
The issue I am stuck is as under:

I have a post form, where I have a Milti Select box for categories, so
I can select all the categories that the post belongs to and post it.
It works fine and all the relevant entries goes to the correct tables
(posts, categories, categories_posts).

I am using Tree structure, so I have lft and rght set in the
categories table.

I have two types forms field in different forms which is to be
populated by $categories:
1. Dropdown - for creating new categories in system.
2. Multi-Select - for posts

and code of $controllers that I used is:

Dropdown: $this->Category->generatetreelist (null, '{n}.Category.id',
'{n}.Category.cat_name', '...');
This works fine and list is seem to be in hierarchy

But problem is when I use similar code of Posts form, the category
list is just in plain list without hierarchy. Code used for that is:

$categories = $this->Post->Category->generatetreelist (null,
'{n}.Category.id', '{n}.Category.cat_name', '...');

And in view:
echo $this->Form->input('Category.Category', array('label' =>
'Categories:', 'options' => $categories));

I want to get an hierarchical list of categories in the multi-select
field as set up in database. I tried many ways but no result.
Please advice.

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