Edit
-
Dynamic Form Submission
The JavaScript
jQuery(function($){
$("#contact").submit(function(){
//grab form values before blowing it out of the DOM in the next line
values=$(this).serialize();
$("#contact").html( "<p>Sending message...</p>\n" );
//send the values to the PHP handler
$.aja...
Code
JavaScript
PHP
JQuery
2013
-
Pagination Logic
<?php
$items = array(
0 => array( "item 1", "2013-09-13", "1" ),
1 => array( "item 2", "2013-09-14", "2" ),
2 => array( "item 3", "2013-09-15", "3" ),
);
######## CALCULATIONS #########
# set per-page var
if (isset($_GET["perpage"])) $perpage = $_GET["perpage"];
else $perpage = 10;
# calc ...
Code
Template Coding
PHP
2013
-
Fill array with server request URI strings
<?php
$request = explode( "/", $_SERVER["REQUEST_URI"] );
array_shift( $request );
print_r( $requests );
?>...
Code
Template Coding
PHP
2013
-
LDAP Connect and Bind Test
<?php
$host = "127.0.0.1:10389";
$ldap = ldap_connect($host);
ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
$username = "uid=admin,ou=system";
$password = "secret";
if( $bind = ldap_bind($ldap, $username, $password) )
echo( "logged into ".$host." as ".$username );
else
echo( "Fa...
Code
Template Coding
PHP
2013
-
Create symlinks
<?php
symlink('/homepages/21/d93015512/htdocs/library/organic_connectivity',
'/homepages/21/d93015512/htdocs/drupal/sites/all/modules/organic_connectivity/lib');
?>...
Code
Information Structuring
PHP
2014
-
Manually reset Drupal admin password
<?php
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
require_once DRUPAL_ROOT . '/includes/password.inc';
if (isset($_GET['pass']) && !empty($_GET['pass'])) {
$newhash = user_hash_password($_GET['pass']);
}
else {
die('...
Code
Drupal
PHP
2014
-
Rename stuck field names
<?php
$fields = array(
'field_inspirational_imagery' => 'field_images',
);
// Loop through each of the fields/tables with the old name and change them
foreach($fields as $field_name => $new_field_name) {
// First check that field_name exists
if(!db_table_exists('field_data_' . $field_name...
Code
Drupal
PHP
2014
-
Drupal DB Query to find Children (Recursively)
<?php
function loadchildrens($context){
$sql_children = "SELECT node.nid AS nid,
node.vid AS node_vid,
node.title AS node_title
FROM node node
LEFT JOIN content_field_connection node_data_field_connection ON node.vid = node_data_field_connection.vid
WHERE (node.type in ('category')) AND (node_data_field...
Code
Drupal
PHP
Template Coding
2014
-
IXIAS
my homepage
Work
Stylesheet Coding
JavaScript
Graphic Design
Information Structuring
PHP
2015
-
AG & Associates
Construction Portfolio & Promotion
Work
Wordpress
Stylesheet Coding
PHP
2016
-
Rate Your Customer / Rate My Contractor
Work
Wordpress
Stylesheet Coding
PHP
2015
-
Find which file a function is defined in
<?php
$reflFunc=new ReflectionFunction('name_of_function');
echo($reflFunc->getFileName().':'.$reflFunc->getStartLine());
?>...
Code
PHP
2016