6){ $category_id = ''; } ///////////////////////////////////// // optional page bgcolor //$BCOLOR = "bgcolor='#D8D8C4'"; ///////////////////////////////////// if($category_id==''){ // no catid, just print the categories $titlebar_text = 'PSOUG Code Library: Code Categories'; $page_title = "Oracle PL/SQL - $titlebar_text"; $header_bar_text = $titlebar_text; include_once('header.php'); // set the width of the table... $code_cat_top = str_replace('TTOPWIDTH', '640', $table_top_1); // set the alignment of the table... $code_cat_top = str_replace('TTOPALIGN', 'center', $code_cat_top); // set the alignment of the cell... $code_cat_top = str_replace('TTOPCALIGN', 'left', $code_cat_top); print $code_cat_top; print '
'; print '
    '; // cid category_name parent_id description owner_id $category_query = "SELECT * FROM plibcategories"; $category_result = mysql_query($category_query); while($cat_row = mysql_fetch_array($category_result)){ $cid = $cat_row['cid']; $category_name = $cat_row['category_name']; $cat_description = $cat_row['cat_description']; // skip the bogus '1' top-level category if($cid=='1'){continue;} if($use_oval == ''){ // if doing the Oracle category, add the "formerly morgan's library" tag if($cid=='4'){ $lib_tag = '
    To view the original pages (which were formerly called "Morgan's Library"), you can click here.
    '; }else{ $lib_tag = ''; } }else{ // if doing the Oracle category, add the "formerly morgan's library" tag if($cid=='4'){ $lib_tag = <<
    To view the original pages (which were formerly called "Morgan's Library"), you can click here.
    EOM; }else{ $lib_tag = ''; } } print <<$category_name - $cat_description $lib_tag EOM; } print '
'; print '
'; $searchbox_type = "vertical"; include("/var/www/virtual/psoug.org/htdocs/searchbox.htm"); print '
'; print $table_bot_1; $rdnum = rand(1,100); if($rdnum <=50){ print << EOM; }else{ print << EOM; } include_once('footer.php'); exit; // end if cid is blank }else{ // cid is populated, check it and get the category contents... //////////////////////////////////////// // for pagination $page = sanitize(1,4, $_GET['page']); if($page){$pageNR = $page;}else{$pageNR = 1;} $start = ($pageNR * $items_per_page) - $items_per_page; $navigator_query = mysql_query("SELECT * FROM plibsnippets WHERE category_id='$category_id'"); $totalrows = mysql_numrows($navigator_query); // calculate out total number of pages $nr_pages = ceil(mysql_num_rows($navigator_query)/$items_per_page); $paginator = navigator(); //////////////////////////////////////// $category_query = "SELECT * FROM plibcategories WHERE cid = '$category_id'"; $category_result = mysql_query($category_query); $cat_row = mysql_fetch_array($category_result); $cid = $cat_row['cid']; $category_name = $cat_row['category_name']; $cat_description = $cat_row['description']; $titlebar_text = "$category_name Category"; $page_title = "Oracle PL/SQL"; $header_bar_text = $titlebar_text; include_once('header.php'); // if doing the Oracle category, add the "formerly morgan's library" tag if($cid=='4'){ print '
To view the original pages (which were formerly called "Morgan's Library"), you can click here.
'; } print "$paginator

"; print '
'; if($category_id=='1'){$preword = 'PL-SQL-Code';} if($category_id=='2'){$preword = 'PHP';} if($category_id=='3'){$preword = 'Javascript';} if($category_id=='4'){$preword = 'Oracle-PL-SQL';} if($category_id=='5'){$preword = 'mySQL';} if($category_id=='6'){$preword = 'Perl';} $content_query = "SELECT * FROM plibsnippets WHERE category_id = '$category_id' ORDER BY name ASC LIMIT $start, $items_per_page"; $content_result = mysql_query($content_query); while($content_row = mysql_fetch_array($content_result)){ $sid = $content_row['sid']; $snippet_name = $content_row['name']; $snippet_description = $content_row['description']; $language = $content_row['language']; $highlight_mode = $content_row['highlight_mode']; $content_id = $content_row['content_id']; $last_modified = $content_row['last_modified']; $owner_id = $content_row['owner_id']; $snippet = $content_row['snippet']; // prep the pretty url from the name $pname = ereg_replace(' ', '-', $snippet_name); $pname = preg_replace("/[^0-9a-zA-Z\_-]/i",'', $pname); $pname = $pname . '_' . $sid; $pname = ereg_replace('__', '-', $pname); $pname = ereg_replace('--', '-', $pname); $pname = "$preword-$pname"; // dynamically adjust the clipping length of the description // based on the length of the name/title $name_len = strlen($snippet_name); $MAXLENGTH = (90 - $name_len); $CLIPTO = $MAXLENGTH - 5; if(strlen($snippet_description) > $MAXLENGTH){$snippet_description = substr($snippet_description, 0, $CLIPTO) . "... ";} if ($snippet_description != "") { $snippet_description = " - ".$snippet_description; } if($LINETOGGLE=='1'){ $BGCOLOR = '#cecece'; $LINETOGGLE='0'; }else{ $BGCOLOR = '#ffffff'; $LINETOGGLE='1'; } print << $snippet_name$snippet_description EOM; } print '
'; print "

$paginator

"; $rdnum = rand(1,100); if($rdnum <=50){ print << EOM; }else{ print << EOM; } include_once('footer.php'); exit; } ?>