Helpful Command Line Cursor shortcuts

I usually forget these commands when I am in a rush time =D

    * ctrl-a: move to front of line
    * ctrl-e: move to end of line
    * ctrl-w: delete word before cursor
    * ctrl-r: search past command history
    * up/down arrow: page through previous commands
    * alt-b / alt-f: move backward/forward one word (without deleting)

I hope It helps you too =D lol

How to Cake PHP Search method

Cake PHP is a powerful MVC Framework that I am really enjoying however sometimes I don't have enough time to find the way that Cake PHP do something like a search using a OR clause =D So if you were looking for a direct instruction here you are:

<?php
function search() {

// $k is a POST with the keyword search...
$k = $this->data['Yourmodel']['search_key'];

$this->Yourmodel->recursive = 0;
// Displays all records if you didn't POST a keyword
if(empty($k)) {
$results = $this->paginate();
}
else {

Drupal Web Services + Json Server + Cake PHP - Part 3

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

Drupal Web Services + Json Server + Cake PHP - Part 2

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[] = services

1.2 - Module file wilsolutions_service.module:

Drupal Web Services - Using SOA to solve applications integrations problems. Part 1

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,

How to theme the login box

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

URL Encoding Table

Hello there!

So, if you are looking for how to pass special chars on your URL here you are the table with some encodes:

char - URL Encoded
; - %3B
? - %3F
/ - %2f
: - %3A
# - %23
& - %26
= - %3D
+ - %2B
$ - %24
, - %2C
<space> - %20 or  +
% - %25
< - %3C
> - %3E
~ - %7E

Faceted Search - How to change the sort order

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.

Comments - How to change the comments Controls to display only links

Hi,

Today I'm going to show you how to change the Comments Controls, we will hide all controls and just display 2 links: Oldest and Newest.

1 - Create a Hook Form Alter in your template.php file:

<?php

function wilsmodule_form_alter(&$form, $form_state, $form_id) {

}
?>

2 - Add a if and change all the Comment Controls Items to be Hidden:

<?php
if($form_id=='comment_controls') {
$form['mode'] = array('#type' => 'hidden',
'#default_value' => 4,
'#weight' => 1,
);
$form['order'] = array(
'#type' => 'hidden',

Creating a different template to your pages.

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';
  }
}
?>

Syndicate content