So, here we are going to create a Cake PHP Controller without a Model.
This Controller will perform Calls to a Drupal Web Service as you saw in the previous Articles, the Call will return a Drupal User Object in Json format.
1 - Create your Controller:
<?php
class WilsolutionsServices Controller extends AppController {
var $uses = array();
var $components = array('RequestHandler', 'Session');
private $api_key = '1641795f7716f5d5a93388aa0843ae3d';
function getUser() {
$args = array(
'method'=>'wilsolutions_user.get',
Hello there, to this Article I am considering that you have already setup your Drupal Services, Json Server and already have a beautiful Cake PHP running...
So, let's code:
1 - Created a Module:
- Folder: wilsolutions_service
- Files: wilsolutions_service.info and wilsolutions_service.module
1.1 - Info file wilsolutions_service.info:
;$Id$
name = "Wilsolutions Service"
description = "Provides services to interact with Users Object."
core = 6.x
dependencies[] = services1.2 - Module file wilsolutions_service.module:
Nowadays there's a huge need to integrate applications, systems, people... =D well people integration is other subject related to Social Networks hehehe
As part of an integration, my client requested to develop a Cake PHP application and this application needed to interact with Drupal.
Well, we are talking about the apps here, different Sessions and Domains...
At glance I was poking around with Drake http://drupal.org/projects/drake a module that dispatcher a Cake PHP app into Drupal,
Hello there!
Today I am talking about the login customization.
Here you are the steps:
1 - Create a new block called login.
2 - Add the following code:
<?php
global $user;
?>
The Drupal Core Search is good, however sometimes we need to enhance It.
The Faceted Search: http://drupal.org/project/faceted_search is a best way!
Faceted Search has many features and one of them is the possibility to attach the results to a View http://drupal.org/project/views
As part a requirement I needed to display links with options to change the default sort order of the Faceted Search Results.
Here you are the solution:
1 - On the Views admin section, add a default sort order to your results.
On my 1st Drupal Project, my client had a layout with two homepage versions: Authenticated/Unautheticated users.
To solve my problem I needed to create 2 PHP Templates and write some code in my template.php file, here is my code:
<?php
/**
* Set the correct template to the homepage auth or unauth.
* @param $vars
* @param $hook
*/
function phptemplate_preprocess_page(&$vars, $hook) {
global $user;
if ($user->uid) {
$vars['template_file'] = 'page';
}
else {
$vars['template_file'] = 'page-front';
}
}
?>