How to get code to written in .inc file

Being able to include other files into your HTML code, or for your PHP scripts, is a useful thing. The include( ) function allows you do this.

Suppose you have a text file that you want to include in a web page that you’ve already got up and running. You could copy and paste the text from the file straight into you HTML. Or you could use the include( ) function

<?php

/**
* Menu callback; page_description
*/
function slickguns_select_sub_cat_page() {
$vocabulary_id = $_REQUEST[‘main_cat_id’];
$cat_id = $_REQUEST[‘cat_id’];

$qry2 = ‘SELECT node.nid AS nid, term_data.tid AS term_data_tid, term_data.name AS term_data_name, term_data.vid AS term_data_vid FROM node nodeĀ  LEFT JOIN term_node term_node ON node.vid = term_node.vid LEFT JOIN term_data term_data ON term_node.tid = term_data.tid WHERE (node.nid = %d) AND (term_data.vid in (%s)) ORDER BY term_data_name ASC’;
$result2 = db_query($qry2,$cat_id,$vocabulary_id);
$sub_cats = “”;
while ($category2 = db_fetch_object($result2)) {
$sub_cats .= ‘<option value=”‘.$category2->term_data_tid.'”>’.$category2->term_data_name.'</option>’;
}
$sub_cats .= ‘
‘;
print trim($sub_cats);
}

Was this article helpful?