Help

2015-03-25 Thread Musa Dima
Dear All I'm very new for cakePhP i want to learn cake php from Scratch any 
body who can give me link for full video tutorial and other material.
warmly regards

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Exploring Breadcrumbs Feature

2010-06-18 Thread Dima
I am familiar with using breadcrumbs in cakephp, but yesterday I was
thinking that I want my breadcrumbs to behave smarter.

So, I have a list of products in a database.  Each product has a
category_id and a city_id.  If I click on product 3, the breadcrumb
looks something like:

Home  City X  Category Y  Product 3

Now, if I click on 'City X', it shows me all products with that
city_id.  Similarly, if I click 'Category Y', it shows me all products
with that category_id.

The complex behavior I want to introduce is as follows: if I click
'Category Y', I want it to display all products with that category_id
AND the city_id already defined.  I think that this behavior might
actually require me to develop my controller some more (and possibly a
new view) but I was wondering if something like this can be done with
breadcrumbs.

Thanks,
Dima

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en


Re: Missing Database Table error

2010-06-11 Thread Dima
You can include the following in your model to specify the name of the
table to use if you do not want to follow Cake's naming convention.
Try this:

[code]
var $useTable = your table name;
[/code]

So your model will look something like this:

[code]
class User extends AppModel
{
   var $name = 'User';
   var $useTable = 'user_votes';
   var $hasAndBelongsToMany = array(
  'UserVote' = array(
 'className' = 'UserVote',
 'foreignKey' = 'user_id',
 'dependent' = true
  )
   );
}
[/code]

Hope this helps,
Dima

On Jun 11, 4:55 pm, Ed Propsner crotchf...@gmail.com wrote:
 All of my underscored table names work just fine, but this is something I
 wonder about:

 If both parts of the underscored table name are plural (users_votes) ..
 would the model be UsersVote or UserVote. Do both parts get singularized?

 In any case, your issue still seems to be with naming conventions.

 - Ed

 On Fri, Jun 11, 2010 at 5:43 PM, Jonathon Musters luvz2...@gmail.comwrote:

  I think the new table should be called UsersVotes. No underscore.

  On 6/11/10, Andrew grie...@gmail.com wrote:
   Hello all,

   I've been using cakephp for a few months now and I love it!! I must
   admit I am still getting used to some of the concepts. At the moment
   I'm trying to add a database bridging table for a HasAndBelongsToMany
   Model. My three models involved are Users, Votes and Users_Votes.

   So when I call the view /users_votes/create/ I get the error message

   Missing Database Table
   Error: Database table user_votes for model UserVote was not found.
   Notice: If you want to customize this error message, create app/views/
   errors/missing_table.ctp

   I am using Cakephp 1.3.

   - My database names are Users, Votes and Users_Votes
   - My model names are user, vote, and uservote
   - I think I have my models correct

   class User extends AppModel
   {
       var $name = 'User';

          var $hasAndBelongsToMany = array(
           'UserVote' = array(
                   'className' = 'UserVote',
                   'foreignKey' = 'user_id',
                   'dependent' = true
           )
       );
   }

   class UserVote extends AppModel
   {
       var $name = 'UserVote';

         var $belongsTo = array
         (
           'Vote' = array
                 (
                  'className'  = 'Vote',
                  'foreignKey' = 'id'
           )
       );
   }

   class Vote extends AppModel
   {
       var $name = 'Vote';

         var $hasAndBelongsToMany = array
         (
           'UserVote' = array(
                   'className' = 'UserVote',
                   'foreignKey' = 'vote_id',
                                 'dependent' = true
           )
       );
   }

   Thanks!

   Check out the new CakePHP Questions sitehttp://cakeqs.organd help
  others
   with their CakePHP related questions.

   You received this message because you are subscribed to the Google Groups
   CakePHP group.
   To post to this group, send email to cake-php@googlegroups.com
   To unsubscribe from this group, send email to
   cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor
more options, visit this group at
  http://groups.google.com/group/cake-php?hl=en

  Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
  with their CakePHP related questions.

  You received this message because you are subscribed to the Google Groups
  CakePHP group.
  To post to this group, send email to cake-php@googlegroups.com
  To unsubscribe from this group, send email to
  cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor
   more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en


Re: Question Regarding Model Grandchildren

2010-06-09 Thread Dima
cricket - thanks for the suggestion.  I've been reading up on MPTT,
but the first link doesn't have the demo described on the site.  I was
wondering if you could post our example just so I can go through it
and see how MPTT structured table calls are made.

Thanks,
Dima

On Jun 8, 8:10 pm, cricket zijn.digi...@gmail.com wrote:
 On Jun 8, 4:31 pm, Dima dmitriy.pind...@gmail.com wrote:

  First, sorry if subject name isn't accurate; I don't know how exactly
  to phrase what I'm searching for...

 I know the situation. But yours seems apt.



  Here's the issue- I have a table which generates a menu for me.  The
  table has primary_key, name, parent_id, display, order_in_list.  Below
  is a sample table with display and order_in_list removed.
  primary  key
  ...

  Here's roughly what the menu should look like:

  -MenuItemA
      -SubItemA
      -SubItemB
  -MenuItemB
      -SubMenuA
          -SubItemC
          -SubItemD

  This is what my model currently is:

  var $hasMany = array
  (
          'ChildNavMenu'=array
          (
                  'className'='Navmenu',
                  'foreignKey'='parent_id',
                  'conditions'=array
                  (
                          'display'='1'
                  ),
                  'order'='order_in_list'
          )
  );

  This correctly creates children of parents, BUT fails to create
  children of children of parents (SubItemC + SubItemD in example
  above.)  Does anybody know of a way to change the $hasMany in order to
  include this critical data?

  Thanks,
  Dima

 You'd have to create a model for the child menu items, then create a
 hasMany assoc. with grandchild items.
 If it were up to me, I'd use MPTT [1] and TreeBehavior. That way, you
 don't need to create child (or grandchild) models. This is especially
 important if the branch may go deeper. You simply have one model for
 all menu items and specify the parent_id, left, and right (see
 explanation at the links below). The TreeBehavior makes using this
 quite simple.

 [1] Modified Preorder Tree 
 Traversalhttp://www.ad7six.com/entries/view/56/Working-with-Tree-data-%28MPTT%29http://articles.sitepoint.com/article/hierarchical-data-databasehttp://dev.mysql.com/tech-resources/articles/hierarchical-data.html

 There's also AD76's TreeHelper. Highly 
 recommended.http://bakery.cakephp.org/articles/view/tree-helper-1

 It can be a bit confusing to set up the templates for the helper but
 it works like gangbusters. Have a look at all this and let me know if
 you need some help. I can give you a complete example using a Section
 model (basically, a file system hierarchy) that works really well.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en


Re: Using Javascript-link Inside An Element

2010-06-08 Thread Dima
My original implementation did exactly what you describe but I was
hoping that it could be done otherwise.  Guess not.

Thanks,
Dima

On Jun 7, 8:12 pm, calvin cal...@rottenrecords.com wrote:
 You only use echo when you're linking them inline. So you would never
 have something like:

 echo $javascript-link($scriptname, false);

 It would either be:

 echo $javascript-link($scriptname);

 or:

 $javascript-link($scriptname, false);

 Unfortunately, you can't use the $scripts_for_layout variable in the
 layout or elements included from the layout because usually by that
 point the variable has already been printed out.

 Your best bet would be to just place inline link calls in the header
 section of the layout.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en


Question Regarding Model Grandchildren

2010-06-08 Thread Dima
First, sorry if subject name isn't accurate; I don't know how exactly
to phrase what I'm searching for...

Here's the issue- I have a table which generates a menu for me.  The
table has primary_key, name, parent_id, display, order_in_list.  Below
is a sample table with display and order_in_list removed.
primary  key
|name
||parent_id
|| |
|| |
1   MenuItemA   0
2   MenuItemB   0
3   SubItemA  1
4   SubItemB  1
5   SubMenuA2
6   SubItemC 5
7   SubItemD 5

Here's roughly what the menu should look like:

-MenuItemA
-SubItemA
-SubItemB
-MenuItemB
-SubMenuA
-SubItemC
-SubItemD

This is what my model currently is:

var $hasMany = array
(
'ChildNavMenu'=array
(
'className'='Navmenu',
'foreignKey'='parent_id',
'conditions'=array
(
'display'='1'
),
'order'='order_in_list'
)
);

This correctly creates children of parents, BUT fails to create
children of children of parents (SubItemC + SubItemD in example
above.)  Does anybody know of a way to change the $hasMany in order to
include this critical data?

Thanks,
Dima

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en


Using Javascript-link Inside An Element

2010-06-07 Thread Dima
I'm pretty new to CakePHP so it is likely that my issue is rather
simple to fix.  I have a custom element which I created called
nav_menu.cpt.  I call this element from default.cpt using:

?php echo $this-element('nav_menu'); ?

For my element to work properly, I need to import 3x .js files and
1x .css file; I have placed these files in /webroot/js/ and /webroot/
css/ respectively and am attempting to call them inside the element
like so:

?php
$javascript-link('mootools-for-dropdown', false);
$javascript-link('UvumiDropdown-compressed', false);
$javascript-link('nav_menu', false);
$html-css('uvumi-dropdown');
?

However, when the page loads and I check page source, it doesn't
include these files in the header.  I've also tried calling this
following line in default.cpt with no success:

?php e($scripts_for_layout); ?

What am I doing wrong??

Thanks,
Dima

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en


Re: cakephp

2010-06-07 Thread Dima
This sounds like an issue with the router which is located at /config/
routes.php
Try adding the following line into that file:

Router::connect('/', array('controller' = 'questions', 'action' =
'home'));

This will tell CakePHP that if you go to localhost/ it will take you
to the questions controller and the home action.
I just finished going through the quickwall tutorial myself and had
this issue :)  In case this doesn't work, try playing around with that
line and giving it different parameters based on how you set your app
folder up.

Dima

On Jun 6, 11:18 pm, Ats swamy0...@gmail.com wrote:
  Hi i am new to cakephp
 i am getting this error when i am runninghttp://localhost/quickwall/

 Error:  The requested address '/' was not found on this server.
 help me to correct this error

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en


Re: Using Javascript-link Inside An Element

2010-06-07 Thread Dima
vekija, thanks a ton for your help!!  I added echo in front of all 4
of the lines in nav_menu.cpt.  I was immediately able to see the style
sheets kick in; however, when I look at page source, it still doesn't
show those files in the page header and is not displaying correctly.
Am I using the ?php e($scripts_for_layout); ? correctly?  Does it
have to go before/after a certain point in the header?

Thanks again,
Dima

On Jun 7, 4:10 pm, vekija vedran.konto...@gmail.com wrote:
 you have to echo those :)

 echo $javascript-link('mootools-for-dropdown', false);

 On Jun 7, 8:43 pm, Dima dmitriy.pind...@gmail.com wrote:

  I'm pretty new to CakePHP so it is likely that my issue is rather
  simple to fix.  I have a custom element which I created called
  nav_menu.cpt.  I call this element from default.cpt using:

  ?php echo $this-element('nav_menu'); ?

  For my element to work properly, I need to import 3x .js files and
  1x .css file; I have placed these files in /webroot/js/ and /webroot/
  css/ respectively and am attempting to call them inside the element
  like so:

  ?php
          $javascript-link('mootools-for-dropdown', false);
          $javascript-link('UvumiDropdown-compressed', false);
          $javascript-link('nav_menu', false);
          $html-css('uvumi-dropdown');
  ?

  However, when the page loads and I check page source, it doesn't
  include these files in the header.  I've also tried calling this
  following line in default.cpt with no success:

  ?php e($scripts_for_layout); ?

  What am I doing wrong??

  Thanks,
  Dima

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en


Re: one to one relationship (ADD)

2007-04-02 Thread dima

Christian,

If you're worried about integrity, you may have to resort to using
transactions in your db.
Consider the InnoDB engine if you're using MySQL.

Also, you would need to implement begin(), commit() and rollback()
function for your model:
http://bakery.cakephp.org/articles/view/228

You should not encounter issues with using another person's inserted
id since the last_insert_id() takes the connection as a parameter and
a single connection cannot be used by two users simultaneously
(provided you're not doing using a persistent environment connection,
which you shouldn't do in the first place).

Finally, you can reserve an new id for each request to /persons/add.
This way, you are sure that each call to the form generates a unique
id. However, this is a complex solution which i know little about.

Hope this helps.

Dim


On Mar 28, 12:48 pm, christianandradet [EMAIL PROTECTED]
wrote:
 but if i do it the way you say maybe when two users want to insert a
 person at the same time,  is it the posibility that the judge gets the
 code of another person??, or maybe the tables are locked when
 inserting i dont know??? or maybe is there another way to do it??
 Please help me thanks

  in your afterSave() of the Person model you can do something along
  these lines:

  if (isset($this-Judge)  !empty($this-data['Judge']))
  {
 $this-data['Judge']['person_id'] = $this-id;
 $this-Judge-save($this-data);

  }

  Dimitry Z.

  On Mar 26, 12:05 pm, christianandradet [EMAIL PROTECTED]
  wrote:

   hi,
   i am traing to insert data with a one to one relationship, i am
   working with this tables:
CREATE TABLE 'people` (
 `id` smallint(5) unsigned NOT NULL auto_increment,
 `lastname` varchar(40) NOT NULL,
 `firstname` varchar(40) NOT NULL,
 PRIMARY KEY  (`id`) )

CREATE TABLE `judges` (
 `person_id` smallint(5) unsigned NOT NULL,
 `location_id` smallint(5) unsigned NOT NULL,
 `flavor` enum('USDJ','USMJ') default 'USDJ' )

   in the people controller:
var $hasOne = array('judge' = array('className'= 'judge',
 'conditions'   = '',
 'order'= '',
 'dependent'=  true,
 'foreignKey'   = 
   'person_id'
   )
 );

   but i don't know how to insert data in both tables at the same time,
   how do i configure the add method??? (i can list both tables)- Ocultar 
   texto de la cita -

  - Mostrar texto de la cita -


--~--~-~--~~~---~--~~
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 to do Multi-Row Edit ?

2007-03-26 Thread dima

You would have to use a custom model to overwrite some functionality
(cake 1.x):
E.g

class MyHtml extends Html
{
   ...
   function setFormTag($tagValue) {
  $parts = explode(/, $tagValue);

  $this-model = $parts[0];
  $this-field= array_pop($parts);

  // We add a class attribute to indicate the index of the model
  if (count($parts)  1)
 $this-modelIndex = $parts[1];
  else
 $this-modelIndex = null;
   }

   ...
   function tagValue($fieldName) {
  $this-setFormTag($fieldName);
  if ($this-modelIndex !== null)
  {
 // This assumes that your data is like so:
 // data = array('Model'=array(array('Model'=array(/* data
*/; // Default cake
 // which can be obtained with $this-data['Model'] = $this-
Model-findAll();

 if (isset($this-params['data'][$this-model][$this-
modelIndex][$this-model][$this-field])) {
return h($this-params['data'][$this-model][$this-
modelIndex][$this-model][$this-field]);
 } elseif(isset($this-data[$this-model][$this-modelIndex]
[$this-model][$this-field])) {
return h($this-data[$this-model][$this-modelIndex]
[$this-model][$this-field]);
 }
  }
  else
  {
 return parent::tagValue($fieldName);
  }
   }
   ...
}


In your view, you can then do the following:

?php foreach ($this-data['Product'] as $i = $rec) : ?

  tr
 td?= $rec['Product']['name'] ?/td
 td?= $myhtml-input(Product/$i/qty) ?/td
  /tr

?php endforeach; ?

Please note that this code was not tested.
Also, the id of your input will become Product0Qty, Product1Qty, etc.

Please contribute your final solution. There are many with the same
issue :S.

Thanks.

Dimitry Z


--~--~-~--~~~---~--~~
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: Links and Images with correct path from pure html

2007-03-26 Thread dima

Korcs,

Thanks for re-posting on the Group :)

Could you provide some additional code?

From what I can tell, you would need a custom helper like so:

class CustomHelper
{
   function parseAnchors($content)
   {
  // Replaces all anchors locations to an absolute value.
  return preg_replace_callback('href=([^]+)', array($this,
'__parseAnchorsCallback'));
   }

   function __parseAnchorsCallback($matches)
   {
  // $this-siteRoot is the absolute path of your pages.
  // e.g. / or http://domain.com/
  return 'href=' . $this-siteRoot . $matches[1] . '';
   }

   function linkToImage()
   {
  // Same as for the anchors, but with a different root...
   }
}

And in your view, you would do something like so

textarea?= $custom_helper-parseAnchors($this-data['Page']
['content']) ?/textarea

But from what you've written, you are already doing this (?)

Dimitry Z.


On Mar 26, 12:07 pm, korcs [EMAIL PROTECTED] wrote:
 Hi Bakers,

 I am working on a refactoring project for an existing cms andI have
 decided to make it using cake.

 The CMS has an existing database with
 thousands of articles, stored basically as HTML code, where all the
 links and images appear as HTML tags like href..., or img...with
 relative links. (f.e.img src=uploads/news/images/test.jpg).

 I want to implement the editing function of the new cake based CMS by
 using tinyMCE and faced the problem that it is quite a hard nut to get
 my images and links displayed correctly at the front end.

 I think that the solution should be to parse the html code before
 displaying and replace the img...or href...tags using the html
 helper.
 This would be a solution for displaying the images and links when
 viewing a page, but I am afraid that this still don't solve the
 problem, that the images are not showing up in the tinyMCE editor
 while editing...

 If someone already had the same problem and has a baked solution,
 would be great if he would share it with me and other bakers who are
 struggeling with the this issue.

 Thanks,

 korcs


--~--~-~--~~~---~--~~
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 to do Multi-Row Edit ?

2007-03-26 Thread dima

CC96AI,

You're right about modifying the tag templates.

There would have to be more changes than the ones i mentioned above.
However, it's a starting point :).

As for it being a good idea, you can implement your own tags. Since
you're subclassing HtmlHelper you can redefine the $tags class
attribute to have your own templates. Also, you would need to modify
the rendering of those templates.

Dim



On Mar 26, 3:57 pm, cc96ai [EMAIL PROTECTED] wrote:
 in your provided code,
 we might to update helper.php

 var $tags = array('link' = 'a href=%s %s%s/a',
 'mailto' = 'a 
 href=mailto:%s; %s%s/a',
 'form' = 'form %s',
 'input' = 'input 
 name=data[%s][%s] %s/',
 'hidden' = 'input type=hidden name=data[%s][%s] %s/',

 I m not sure thats good idea or not


--~--~-~--~~~---~--~~
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: Creating links a la Html helper in a component

2007-02-14 Thread dima

Rosie,

You've started quite a debate here :).
I am currently building a CMS using Cake and tinyMCE as well.

I believe you should have all URL mapping done using Components and
not the view.

The solution I am aiming towards is to have the images referenced like
so:
// Images is a controller and render is a function that outputs the
content of the image
/cms/images/render/12345

Once time comes to render the page for the front-end, you can use a
component like so:
// This would take place inside your controller
ob_start();
$this-render('page');
$content = ob_get_clean();

// FrontEndFilter takes care of looking for anchors that reference the
cms and rewriting them to point to the appropriate location
$FrontEndFilter = new FrontEndFilter();
$FrontEndFilter-startup($this);
$filteredContent = $FrontEndFilter-filter($content);

// at this point, all /cms/images/0 should point to their
appropriate URLs (e.g. http://www.domain.com/images/image_0.jpg)

This solution would have all your URLs created using a component, and
not a helper. Inside your helper, you can have something like $this-
controller-FrontEndFilter-transform($url).

This, of course, implies the data of the image is stored in the
database.

Hope this makes any sense.
If you have the time, please let me know how it goes; I believe we are
working on a very similar project.

Thanks

Dimitry


On Jan 17, 12:17 pm, Rosie F. [EMAIL PROTECTED] wrote:
 Hello all,

 I have a need to create links (both regular and images) from within the
 controller/component side of things.  Normally of course we would use
 the Html helper to make links.  But for this particular need I have,
 the links must be created before sending to the view.  Is there a
 component analogous to the Html helper that i can use to create links
 and image tags?

 Thanks
 Rosie


--~--~-~--~~~---~--~~
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: HTML-considering Truncate()-Function

2007-02-14 Thread dima

Alex,

Under what conditions would you need to truncate content with tags
included?

Here is my function to truncate (called 'cut'). Note that it strips
the tags.

function cut ($string, $length, $padd = '...') {
$string = strip_tags($string);
$returnString = '';

if (strlen($string) = $length)
{
$returnString = $string;
}
else
{
$returnString = substr($string, 0, 
$length-strlen($padd)).$padd;
}

return $returnString;
}

Hope this helps.

Dimitry Z.



On Feb 14, 1:01 pm, Alex [EMAIL PROTECTED] wrote:
 Hi,

 I'm always wondering if there is a truncate function for a Text (a
 post f.e.) which considers opened HTML tags. Everytime i'd truncated a
 text with the normal truncate function available in TextHelper, some
 html tags werent closed and so my whole page looks damaged.
 So i programmed a function which closes HTML functions.
 I like you to review this function and to tell me your ideas.
 Up to now, the function only acepts std xhtml:

 function truncate($text, $length, $ending = '...', $exact = false) {
 if(strlen(preg_replace('/.*?/', '', $text)) = $length) {
 return $text;
 }

 preg_match_all('/(.+?)?([^]*)/is', $text, $ausgabe,
 PREG_SET_ORDER);

 $total_length = 0;
 $arr_elements = array();
 $truncate = '';

 foreach($ausgabe as $treffer) {
 if(!empty($treffer[1])) {
 //img /
 if(preg_match('/^\s*.+?\/\s*$/s', $treffer[1])) {
 //echo 
 '1:'.htmlspecialchars($treffer[1]).'br';
 ///b
 } else if(preg_match('/^\s*\/([^\s]+?)\s*$/s',
 $treffer[1], $treffer2)) {
 //echo '2:'.htmlspecialchars($treffer2[1]).'br';
 $pos = array_search($treffer2[1], $arr_elements);
 if($pos !== false) {
 unset($arr_elements[$pos]);
 }
 //b
 } else if(preg_match('/^\s*([^\s!]+).*?$/s',
 $treffer[1], $treffer2)) {
 array_unshift($arr_elements,
 strtolower($treffer2[1]));
 //echo '3:'.htmlspecialchars($treffer2[1]).'br';
 }
 $truncate .= $treffer[1];
 }
 $content_length = 
 strlen(preg_replace('/([a-z]{1,6};|#[0-9]+;)/
 i', ' ', $treffer[2]));
 if($total_length = $length) {
 break;
 } else if($total_length+$content_length  $length) {
 $left = 
 $total_length$length?$total_length-$length:$length-
 $total_length;
 $entities_length = 0;
 
 if(preg_match_all('/[a-z]{1,6};|#[0-9]+;/i', $treffer[2],
 $treffer3, PREG_OFFSET_CAPTURE)) {
 foreach($treffer3[0] as $entity) {
 if($entity[1]+1-$entities_length = $left) {
 $left--;
 $entities_length += strlen($entity[0]);
 } else break;
 }
 }
 $truncate .= substr($treffer[2], 0, 
 $left+$entities_length);
 break;
 } else {
 $truncate .= $treffer[2];
 $total_length += $content_length;
 }
 }
 //var_dump($ausgabe);
 if(!$exact) {
 $spacepos = strrpos($truncate, ' ');
 if(isset($spacepos)) {
 $truncate = substr($truncate, 0, $spacepos);
 }
 }
 $truncate .= $ending;
 foreach($arr_elements as $element) {
 $truncate .= '/' . $element . '';
 }
 return $truncate;
 }


--~--~-~--~~~---~--~~
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: Stability of Cake 1.2

2007-02-02 Thread dima

It's the production side of things that worries me most (martin). This
is a live system I am working on and, although the web is forgiving,
there is much dependency on Cake and the CMS built on top. Thanks for
your answers, folks.

Dimitry



On Feb 2, 1:11 am, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
 I upgraded from 1.1 to 1.2. Had some issues with db layer (using
 postgre). Also had to rewrite some pieces of code that generated
 forms. It was really worth it, my forms code looks really nice
 now ;-) . But would not use it for production use yet. I would wait at
 least till the number of ticket in trac decreases.


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



Stability of Cake 1.2

2007-02-01 Thread dima

Does anyone have an indication of the stability of Cake 1.2, as it is
now? I understand that it undergoes constant change, but I would
imagine the base is fairly stable.

Also, has anyone experienced significant difficulty in transferring
from 1.1.1 to 1.2?

The reason I ask is because I require some of the upcoming features
and recoding them would take quite considerable (see precious) time.
Also, I do not wish to mix the 1.1 I currently have installed with
1.2.

Anyone?


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



How to save a FTP folder and subfolders contents list to a text file to print?

2007-01-26 Thread Dima

Hello!
How to save a FTP folder and subfolders contents list to a text file to
print?
Best regards,
Dima
+79035093892


--~--~-~--~~~---~--~~
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: updating an existent field

2006-06-26 Thread dima

Fabrizio,

You might have to do something like this:

$this-data['User']['id'] = $subscribed['User']['id'];
$this-data['User']['subscribed'] = 1;
...
$this-User-save($this-data);
// Notice that Cake in v1.0+ will fetch the User index from
$this-data.

- or -

$subscribed['User']['subscribed'] = 1;
...
$this-User-save($subscribed);


Sincerely,
Dimitry


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