Nov 25, 2011

Add fck editor in cakephp


Installation
1) Copy fckeditor folder to app/webroot/js/
2) Copy fckeditor.php, fckeditor_php4.php, fckeditor_php5.php to app/vendors/

Setup
Create a file in helpers called fck.php in view

<?php
App::import('Vendor', 'fckeditor');

class FckHelper extends AppHelper {

    /**
    * creates an fckeditor textarea
    *
    * @param array $namepair - used to build textarea name for views, array('Model', 'fieldname')
    * @param stirng $basepath - base path of project/system
    * @param string $content
    */
    function fckeditor($namepair = array(), $basepath = '', $content = ''){
        $editor_name = 'data';
        foreach ($namepair as $name){
            $editor_name .= "[" . $name . "]";
        }

        $oFCKeditor = new FCKeditor($editor_name) ;
        $oFCKeditor->BasePath = $basepath . '/js/fckeditor/' ;
        $oFCKeditor->Height="400px";
        $oFCKeditor->Value = $content ;
        $oFCKeditor->Create() ;
    }
}

?>
Usage

1) Add the fck helper to your controller

var $helpers = array('Html','Form','Javascript','Ajax','Fck','Time'); 

2) Use the following line in your views to display the fckeditor

echo $fck->fckeditor(array('Model', 'field'), $html->base, $yourContentVariable); 
Example

<?php echo $fck->fckeditor(array('Page','static_page_description'), $html->base,$this->data['Page']['static_page_description']);?>

*if any type of help is needed regarding prog or concept contact me on dadhich.priyank@gmail.com

Core Helpers in Cakephp


Helpers
Helpers represent component-like classes for the presentation layer of your application, which contain presentational logic shared between many views, elements or layouts.

The CakePHP framework needs a controller in order to make usage of helpers. Each controller has a $helpers property that lists the helpers to be made available in the view. To enable a helper in your view, add the name of the helper to the controller’s $helpers array.


Example


<?php
class ExampleController extends AppController {
var $name = 'Example';
var $helpers = array('Html','Ajax','Javascript');
}

CakePHP features a number of helpers that aid in view creation. They assist in creating well-formed markup (including forms), aid in formatting text, times and numbers, and can even speed up Ajax functionality. Here is a summary of the built-in helpers.
CakePHP Helper
Description
Ajax
Used in tandem with the Prototype JavaScript library to create Ajax functionality in views. Contains shortcut methods for drag/drop, ajax forms & links, observers, and more.
Cache
Used by the core to cache view content.
Form
Creates HTML forms and form elements that self populate and handle validation problems.
Html
Convenience methods for crafting well-formed markup. Images, links, tables, header tags and more.
Js
Used to create Javascript compatible with various Javascript libraries. Replaces JavascriptHelper and AjaxHelper with a more flexible solution.
Used to escape values for use in JavaScripts, write out data to JSON objects, and format code blocks.
Number
Number and currency formatting.
Model data pagination and sorting.
Convenience methods for outputting RSS feed XML data.
Session
Access for reading session values in views.
Text
Smart linking, highlighting, word smart truncation.
Time
Proximity detection (is this next year?), nice string formatting(Today, 10:30 am) and time zone conversion.
Xml
Convenience methods for creating XML headers and elements.

 *if any type of help is needed regarding prog or concept contact me on dadhich.priyank@gmail.com


Nov 21, 2011

Initialize Setup of cake php


 Steps To Setup cakephp

  • Download cake php from http://cakephp.org/
  • Extract This and paste this folder in xampp's htdoc/or wamp servers www folder
  • Now its Time to configure the cakePhp




but firstly run this folder by localhost u will find some errors


Cake's Database Configuration

First you need to make a copy of the database.php.default configuration file found incake_directory/app/config. Make sure you make a copy inside the same folder, after that just take off the .default and you have you blank configuration file. Using you favorite text or code editor, open it up, and after scrolling down a bit, you should see:
class DATABASE_CONFIG
{
  var $default = array('driver' => 'mysql',
    'connect' => 'mysql_connect',
    'host' => 'localhost',
    'login' => 'user',
    'password' => 'password',
    'database' => 'project_name',
    'prefix' => '');

  var $test = array('driver' => 'mysql',
    'connect' => 'mysql_connect',
    'host' => 'localhost',
    'login' => 'user',
    'password' => 'password',
    'database' => 'project_name-test',
    'prefix' => '');
}
First off, you probably notice there is actually two database setups there. This is because cake can actually handle more than just one database at a time, you can even add more than two. For our purposes, however, we need only one, so you can delete the second one. Most of the stuff should be pretty straight forward, with our complete database config file looking like so:
class DATABASE_CONFIG
{
  var $default = array('driver' => 'mysql',
    'connect' => 'mysql_connect',
    'host' => 'localhost',
    'login' => 'root',
    'password' => '',
    'database' => 'cakephp',
    'prefix' => '');
}
If you open up your cake app in a browser you will see the default cake page, with two extra messages letting you know that you database is setup and connectible. This is really good news, and means that we are pretty much ready to start building our first app. But that is for the next tutorial. For now you can take a break, and be glad your cake app is ready to be built. That's it for this one, but don't forget that when you need some programming assistance, just Switch On The Code.




After Applying this Errors Related to database will remove just check





Still a problem in Run Ckephp with  Salt.Security and cipherSeed 



Try this






  1. edit yourInstallation/app/config/core.php
  2. search for Security.salt and change some random characters (this is so your application doesn't have the same security seed as a billion other installations, which would be a serious security loophole.
  3. Do the same with Security.cipherSeed but use only numbers
  4. save core.php
  5. job done


Now your cake php setup is completed and it will work perfect




Lets enjoy with Cake php
If still You have any problem please contact me on dadhich.priyank@gmail.com

APPROACH TO THE MVC ARCHITECTURE

 Cake is based on an MVC-like architecture that is both powerful and easy to grasp: controllers, models and views guarantee a strict but natural separation of business logic from data and presentation layers.

Controllers contain the logic of your application. Each controller can offer different functionality; controllers retrieve and modify data by accessing database tables through models; and they register variables and objects, which can be used in views.

Models are active representations of database tables: they can connect to your database, query it (if instructed to do so by a controller) and save data to the database. It is important to note that in order to correctly apply the MVC architecture, there must be no interaction between models and views: all the logic is handled by controllers.


Views can be described as template files(means that contans the html or designs) that present their content to the user: variables, arrays and objects that are used in views are registered through a controller. Views should not contain complex business logic; only the elementary control structures necessary to perform particular operations, such as the iteration of collected data through a foreach construct, should be contained within a view.

This architecture can greatly improve the maintainability and the organization of your site’s code:

It separates business logic from presentation and data retrieval.
A site is divided into logical sections, each governed by a particular controller.
When testing and debugging an application, any developer accustomed to CakePHP’s structure will be able to locate and correct errors without knowing all of the details of the code.
Controllers, models and views are stored in pre-defined directories within CakePHP’s directory structure. Here’s the directory structure that’s used:

app/
config/
controllers/
models/
plugins/
tmp/
vendors/
views/
webroot/
cake/
config/
docs/
libs/
vendors/
This directory scheme must be preserved, as it is essential if the framework itself is to work. Cake, like Rails, believes in the importance of convention over configuration: in order to deploy an application, rather than modify dozens of different configuration files, it’s important only to place everything in its proper place; then, you can let the framework do the rest.

Although this may seem worrisome for some developers, it’s a good compromise that can really accelerate the development process.


Enjoy
                             

Sep 29, 2011

Great Achievers



Hello Friends  "Great Achievers" Heartily  welcome You in this Blog 
This is a blog where You will find a lot of knowledge about web Development "Great Achievers" is Group dedicated to serve maximum and Latest  Information for beginners as well as Experienced

Our mission is to provide web solutions that improve productivity, profitability and result in market and satisfaction.
To make global, virtual and multi cultural web projects work .
By this we don’t only mean delivering the proper end result within agreed constraints, but also by running the projects in such a way that they provide a genuine contribution towards a sustainable global society. It will accomplish this by seeking to understand the underlying problems and opportunities and distribute the acquired knowledge.”