Drupal

Drupal Services 3 & Titanium Upload Photo From the Photo Gallery

So this is another example of session authenticated calls to Drupal services this time adding a image upload test form the device Photo Gallery - look at the titanium for more examples you need session authentication, token (user resource , file create , node create & user login & user logout for this to work ) response for matters JSON

Drupal Services + Titanium User Login / out & Create a node

var mydrupalrest ="http://192.168.1.8/ilocal/theend/";
Ti.App.Properties.setString("mydrupalrest", mydrupalrest);


var win = Titanium.UI.createWindow({
    title:'TEST DRUPAL SERVICES',
    backgroundColor:'#fff'
});


//view for login
  
var loginview = Ti.UI.createView({
    backgroundColor:'blue',
    borderRadius:5,
    layout:'vertical',
    top:120,
    height:300,
    width:300
});
  
var username = Ti.UI.createTextField({
    hintText:'Enter your username',
    top:10,
    left:10,
    right:10
});
loginview.add(username);
   

Drupal HTTPS Redirect Via .htaccess

So you got a ssl cert. and need to rediect to https ? cool in your Drupal .htaccess file do this :

  RewriteCond %{HTTPS} off [OR]
  RewriteCond %{HTTP_HOST} ^yoursite.com\.com*
  RewriteRule ^(.*)$ https://www.yoursite.com/$1 [L,R=301]

 # Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Drupal 7 custom views filter from custom table

Ok so you made a drupal 7 module that uses custom tables and you want to use the values in views ,
cool that is cool here is how to do it the easy wa.

1) install schema  (https://www.drupal.org/project/schema)  - to help make your install file :)

2) install schema views (https://www.drupal.org/project/schema_views)  Now go to schema and click the views tab  and scrool down untill you find your table and copy your array:

Now in your module.module file add 2 things

Drupal 7 Ajax Custom Module Example

This is an example  module that  shows some ideas of what you can do  drupal  ajax in a custom module  I will make a custom auto suggest box with the form api , and has ajax call back with the menu call back , stick that in a custom block, then do some jquery stuff to make it all work.

PRE COMMENT :
I Know I  am breaking some best practices  - but that  fine this is just an example ...
if you understand what I am doing below then you are smart enough to  understand what to do next.