Random Snippet of Code and Life

Archive for the 'PHP' Category


06
Nov

Add collapsible content in Drupal

<?php
drupal_add_js(’misc/collapse.js’);
drupal_add_js(’misc/drupal.js’);
?>
<fieldset class=”collapsible collapsed”>
<legend>TEST TITLE</legend>
<p>test</p>
</fieldset>
Technorati Tags: drupal, php, cms, programming, web development, codesnippet

Popularity: 23% [?]

Popularity: 23% [?]


29
Oct

How to build a node in Drupal programmatically

<?php
$newnode = new stdClass();
$newnode->title = ‘Welcome’;
$newnode->body = ‘This is the welcome page for your site. Replace this text with whichever content you\’d like to use for your welcome page.’;
global $user;
$newnode->uid = $user->uid;
$newnode->type = ‘page’;
$newnode->status = 1;
$newnode->promote = 0;
node_save($newnode);
?>
From http://mediumexposure.com
Technorati Tags: Drupal node, Drupal, Programming

Popularity: 9% [?]

Popularity: 9% [?]

Random Snippet of Code and Life is is proudly powered by Wordpress
Navigation Theme by GPS Gazette