Skip to main content

Checking Facebook app permissions and displaying graph data

This is just a little script I wrote up to test out whether or not tabs in facebook could ask for permission. I also wanted to try printing out a graph for users who authorized the application.

HTML Javascript Facebook Apps Tabs JSON Permissions Iframe Graph FB.init() FB.getLoginStatus() FB.ui() getJSON() each() getElementsByTagName() appendChild() createElement() getElementById()

Using the drupal_get_path() function to get the path of a theme

The drupal_get_path() function will look up a string (second argument) in Drupal's system table and find a path in the same row.

PHP Drupal Paths Themes Rows Strings Functions Database Lookup drupal_get_path()

How to manually login to Drupal

The login form can easily be found on a drupal installation by appending ?q=user to the end of the drupal installations root url.

Username Drupal Login Block Theme Installation Root URL Recover Logged Out

Getting the base url in Drupal 7

The global variable $base_url can be used to retrieve the base url within a drupal installation.

Drupal URLs Paths Variables Global

Getting the path to the current theme in Drupal 7

The current theme can be retrieved using the path_to_theme() function. It will return everything after the base url to the current theme.

PHP Base URL Drupal Paths Retrieve Return Themes Functions path_to_theme() print

Simple but powerful CSS file starter template

This is a small template that can be used when creating a brand new CSS file.

CSS Template Files HTML Body div Span Applet Object Iframe h1 h2 h3 h4 h5 h6 p Blockquote pre a abbr acronym address big cite code del dfn em Font img ins kbd q s samp small Strike strong sub sup tt var dl dt dd ol ul li fieldset form Label Legend Table Caption tbody tfoot thead tr th td

Hooks in Drupal 7

Hooks, also called callbacks, can be described as internal Drupal events. Hooks essentially allow Drupal modules to hook into the rest of the Drupal installation.

Hooks Drupal

Adding an external CSS stylesheet to a page in HTML

External stylesheets can be declared between the head tags in an HTML file. The Following snippet shows how to easily call one.

CSS External Stylesheets Declaration Files

Using the setTimeout() method

The setTimeout() method executes a function or an expression after a number of milliseconds have passed.

Javascript Methods Functions Milliseconds Alerts setTimeout() alert()

Removing an element by ID

Removing an element using Javascript can easily be done by calling the function getElementById() followed by the function parentNode.removeChild().

Javascript Elements Remove Child Parent Nodes getElementById() removeChild() parentNode()

Shortcuts in Drupal 7

Shortcuts are one of the many new features found in Drupal 7. They allow admins, or members with permission to create their own sets of links that can be accessed by other users using a shortcut bar.

Drupal

Recursively pull files from directories and filter them

A snippet demonstrating how to use PHP iterators in order to pull a list of files from a directory.

PHP Directories Recursive Iterators Files Filters Classes Methods Regex foreach() preg_match() ExcludeRubyFilesFilterIterator() getInnerIterator()

Load an XML document and output it using the PHP DOM parser

This example will create a DOMDocument-Object and load the XML from note.xml into it. It will then use the saveXML() function to put the XML document into a string and output it.

DOM

The DOM parser

The DOM parser allows for the processing of XML documents in PHP. To work with XML documents, an XML parser is required. The DOM XML parser functions are built into the PHP core.

XML PHP DOM Parsing XML Document Object Model Trees

The jQuery library

jQuery is a cross-browser JavaScript library. It simplifies client-side scripting of HTML. Its syntax makes it easier to navigate a document and select DOM elements, handle events, and create Ajax applications.

Effects Selector Engine Cross-Browser Ajax Javascript Selectors DOM jQuery Events Libraries

Asynchronous JavaScript and XML (Ajax)

Ajax stands for Asynchronous JavaScript and XML. It is a collection of methods to create asynchronous web applications. The DOM is accessed with JavaScript. HTML and CSS are used to markup style information. XML is used for the interchange of data.

Ajax Javascript XML HTML CSS DOM XSLT

The Document Object Model (DOM)

The DOM is a representation of objects in HTML, XHTML, and XML. It is cross-platform and language-independent. It allows for interaction with those objects.

HTML DOM XML DOM Browsers Layers Elements Page Loading Cross Platform

How to call actions directly using actions_do() in Drupal 7

The trigger module is not the only way to call actions. Separate modules can be written to call actions and prepare parameters. This is typically done using a function called actions_do().

Drupal Actions Functions

How Actions are stored in Drupal 7

When an action is created, the information that is set in the configuration form is serialized and saved into the parameters field of the actions table. Immediately before the advanced action is executed, the contents of the parameters field are unserialized and included in the $context parameter.

Actions Databases Drupal Functions Advanced Action Serialized Saved Paremeters Actions Table Execute Contents Unserialized

Using the Context in Actions in Drupal 7

Actions can be called in different contexts. When an action supports multiple triggers, it determines which context it's being used in through the $context variable.

Actions Triggers Drupal
  •  
  • 1 of 2
  • ››
Powered by Drupal 7. Made by Cody Bonney.