Hello,

I am a web developer who usually just writes all my own code from scratch, customizing it to customers needs. I have written a whole app related to the specifics of my customers business and they now want me to wrap it in the Drupal site they use for their website. I am curious if there are simply some lines of included code I can use at the header and footer of my pages which will pull in the Drupal header and Footer, with my content being in the middle content area.

Best,

James

Comments

nirbhasa’s picture

One suggestion: embed your app inside a Drupal page, instead of trying to pull in the rest of Drupal around your app?

The main drupal theming file in your theme folder is page.tpl.php, which has a naming convention which allows it to be themed for different content types, and even individual nodes.

Method: Create a page. Suppose that page has url 'node/4'. Duplicate page.tpl.php and rename it page-node-4.tpl.php (this will automatically fire up when the page with URL node/4 is called, whereas page.tpl.php will load for the rest). Then modify this page to embed the code for your app.

rschwab’s picture

The "drupal way" to do this would be to turn your app into a drupal module. Luckily this is a pretty simple process.

http://drupal.org/node/416986 Will get you started.

You'll probably want to study up on hook_menu and hook_perm as well. They go in pretty much every module I make, especially menu. The name of hook_menu is a little deceiving as it not only builds the menu's for a drupal site, but defines pages as well.

A quick example:

<?php
/**
* Implementation of hook_menu
*/
function advprofilesearch_menu() {
	$items['find-a-family'] = array(
		'title' => t('Find A Family'),
		'page callback' => 'advprofilesearch_page',
		'type' => MENU_CALLBACK,
		'access callback' => 'user_access',
		'access arguments' => array('use family search'),
	);
	
	return $items;
} ?>

This will define a page at http://www.mysite.com/find-a-family that gets built inside the function advprofilesearch_page() and requires the user have the permission "use family search" that I defined elsewhere in my module (in hook_perm to be exact).

Hope this helps!
- Ryan