What Mod rewrite do I use?

  • Shawn
  • Beginner
  • Beginner
  • Shawn
  • Posts: 62

Post 3+ Months Ago

My website is this:

http://www.limophonebook.com/index.php?c=2 (with 2 being the variable for that page)

How do I re-write that as http://www.limophonebook.com/2.html ?


Thanks,
Shawn
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Axe
  • Genius
  • Genius
  • User avatar
  • Posts: 5739
  • Loc: Sub-level 28

Post 3+ Months Ago

Code: [ Select ]
RewriteRule ^([0-9]+).html$ index.php?c=$1& [L]


That would turn 2.html into index.php?c=2, so that when somebody entered 2.html into their browser it would send them to the correct page.

How to turn index.php?c=2 into 2.html, well that's between you and your script. Your script will have to send out the modified URLs. .htaccess can't do that for you, it can only forward from the fake URL to the real URL.
  • Shawn
  • Beginner
  • Beginner
  • Shawn
  • Posts: 62

Post 3+ Months Ago

Maybe I said it wrong..

What I mean is I want to make static urls out of the index.php?c=variable

Does that make sense?

Thanks for the help,
Shawn
  • Axe
  • Genius
  • Genius
  • User avatar
  • Posts: 5739
  • Loc: Sub-level 28

Post 3+ Months Ago

Already answered that one :)

Axe wrote:
How to turn index.php?c=2 into 2.html, well that's between you and your script. Your script will have to send out the modified URLs. .htaccess can't do that for you, it can only forward from the fake URL to the real URL.

That has nothing to do with mod_rewrite. That is purely based on the URLs your script outputs. It's impossible to say what you'd need to do without knowing what PHP scripts you use, or seeing the code.
  • Shawn
  • Beginner
  • Beginner
  • Shawn
  • Posts: 62

Post 3+ Months Ago

Sorry, Im a moron. Ok, here's the code for the c=variable part, what do you think I should change?

Code: [ Select ]
<?
include ("config.php");
include ("include.php");
include ("lang.php");
session_start();
$c *= 1;
if ($c == 0) {    $c = 1;    };
$sql = mysql_query("SELECT name, title, description, pages, ref FROM {$prefix}categories WHERE id = $c");
$current_category = mysql_fetch_array($sql, MYSQL_ASSOC);
if (($c > 1) & !$current_category["name"]){
    header("Location: {$dir}index.php");
};
  1. <?
  2. include ("config.php");
  3. include ("include.php");
  4. include ("lang.php");
  5. session_start();
  6. $c *= 1;
  7. if ($c == 0) {    $c = 1;    };
  8. $sql = mysql_query("SELECT name, title, description, pages, ref FROM {$prefix}categories WHERE id = $c");
  9. $current_category = mysql_fetch_array($sql, MYSQL_ASSOC);
  10. if (($c > 1) & !$current_category["name"]){
  11.     header("Location: {$dir}index.php");
  12. };


Thanks,
Shawn
  • Axe
  • Genius
  • Genius
  • User avatar
  • Posts: 5739
  • Loc: Sub-level 28

Post 3+ Months Ago

that's the index.php?

does your site use any kind of theme/template (like PostNuke)?

Basically, what you'd need to do is look at the PHP functions for handling the output buffer...

ob_start(); (to start capturing the output buffer)
ob_get_contents(); (you'd store what's in this function in a variable)
ob_end_clean(); (to stop capturing the output buffer and clear it)

Now, let's say you did...

PHP Code: [ Select ]
<?php
 
  ob_start();
 
  echo '<html><head><title>Test</title></head><body>This is some text!</body></html>';
 
  $somevar = ob_get_contents();
 
  ob_end_clean();
 
?>
  1. <?php
  2.  
  3.   ob_start();
  4.  
  5.   echo '<html><head><title>Test</title></head><body>This is some text!</body></html>';
  6.  
  7.   $somevar = ob_get_contents();
  8.  
  9.   ob_end_clean();
  10.  
  11. ?>

What would happen is, instead of sending that text out down to the browser, it gets stored in the $somvar variable instead.

You will have to write a function to basically search & replace certain text for certain other text. For example, searching for index.php?c=somenumber, and replacing it with somenumber.html. You'd call this funtion and pass the contents of $somevar to it. The function would process the contents, search and replace the appropriate URLs, and then return it back...

At which point, you'd simply echo my_search_and_replace_function($somevar); and it would get sent out to the browser (as you're no longer capturing the output buffer), with your replaced URLs (that .htaccess is already prepared to accept).

So, basically, in your index.php, right at the top, you want your ob_start(); function. Then at the bottom of your index.php, store the buffer contents in a variable, quit capturing the output buffer, process the variable, and echo out the results.
  • Axe
  • Genius
  • Genius
  • User avatar
  • Posts: 5739
  • Loc: Sub-level 28

Post 3+ Months Ago

Btw, that process will only work if the script doesn't already utilize the output buffer & capturing for some other internal process (such as autolinks, maybe some form of bbcode type stuff, etc.)

But if it doesn't, that should be all you need to do.
  • Shawn
  • Beginner
  • Beginner
  • Shawn
  • Posts: 62

Post 3+ Months Ago

Ok..your too advanced for me. I kinda new to php..html I know but php baffles me. but here is what I gathered I should use:

Code: [ Select ]
{
ob_start();
function replace_for_mod_rewrite(&$s)
{
$urlin =
array(
"'(?<!/)index.php\?p=([0-9]*)'",
);
$urlout = array(
"([0-9]+).html",
);
$s = preg_replace($urlin, $urlout, $s);
return $s;
}
}
  1. {
  2. ob_start();
  3. function replace_for_mod_rewrite(&$s)
  4. {
  5. $urlin =
  6. array(
  7. "'(?<!/)index.php\?p=([0-9]*)'",
  8. );
  9. $urlout = array(
  10. "([0-9]+).html",
  11. );
  12. $s = preg_replace($urlin, $urlout, $s);
  13. return $s;
  14. }
  15. }



However it doesnt work. What do you suggest?

Thanks again,
Shawn
  • Axe
  • Genius
  • Genius
  • User avatar
  • Posts: 5739
  • Loc: Sub-level 28

Post 3+ Months Ago

Close, but not quite, it'd be more like......

PHP Code: [ Select ]
<?php
 
function replace_for_mod_rewrite(&$s)  {
 
  $urlin =
 
  array(
 
    '"index.php\?p=([0-9]+)"'
 
  );
 
  $urlout = array(
 
    '"([0-9]+).html"'
 
  );
 
  $s = preg_replace($urlin, $urlout, $s);
 
  return $s;
 
}
 
  // This is where we start capturing the output buffer...
 
  ob_start();
 
 
 
  // Anything outside of php tags is normally just sent right out to the browser.  Here, we're capturing it to the output buffer instead.
 
 
 
  // Below here is where your page normally performs its regular functions.
 
?>
 
 
 
<html><head><title>This is your title</title></head><body>
 
Here's all your content
 
</body></html>
 
 
 
<?php
 
  // Now we add all this lot to the end of the file after the regular script processes.
 
 
 
  // Here we put the contents of the output buffer into $somevar
 
  $somevar = ob_get_contents();
 
  // And here we empty the output buffer and stop capturing it.
 
  ob_end_clean();
 
  // Here's where we send the contents of the $somvar variable to the replacement function, and echo the result down to the browser (Remember, we're no longer capturing the output buffer, so down it goes).
 
  echo replace_for_mod_rewrite($somevar);
 
?>
 
 
  1. <?php
  2.  
  3. function replace_for_mod_rewrite(&$s)  {
  4.  
  5.   $urlin =
  6.  
  7.   array(
  8.  
  9.     '"index.php\?p=([0-9]+)"'
  10.  
  11.   );
  12.  
  13.   $urlout = array(
  14.  
  15.     '"([0-9]+).html"'
  16.  
  17.   );
  18.  
  19.   $s = preg_replace($urlin, $urlout, $s);
  20.  
  21.   return $s;
  22.  
  23. }
  24.  
  25.   // This is where we start capturing the output buffer...
  26.  
  27.   ob_start();
  28.  
  29.  
  30.  
  31.   // Anything outside of php tags is normally just sent right out to the browser.  Here, we're capturing it to the output buffer instead.
  32.  
  33.  
  34.  
  35.   // Below here is where your page normally performs its regular functions.
  36.  
  37. ?>
  38.  
  39.  
  40.  
  41. <html><head><title>This is your title</title></head><body>
  42.  
  43. Here's all your content
  44.  
  45. </body></html>
  46.  
  47.  
  48.  
  49. <?php
  50.  
  51.   // Now we add all this lot to the end of the file after the regular script processes.
  52.  
  53.  
  54.  
  55.   // Here we put the contents of the output buffer into $somevar
  56.  
  57.   $somevar = ob_get_contents();
  58.  
  59.   // And here we empty the output buffer and stop capturing it.
  60.  
  61.   ob_end_clean();
  62.  
  63.   // Here's where we send the contents of the $somvar variable to the replacement function, and echo the result down to the browser (Remember, we're no longer capturing the output buffer, so down it goes).
  64.  
  65.   echo replace_for_mod_rewrite($somevar);
  66.  
  67. ?>
  68.  
  69.  
  • Shawn
  • Beginner
  • Beginner
  • Shawn
  • Posts: 62

Post 3+ Months Ago

Ok, I tried that and like 4 different variations with no luck. Here is my index file. I dont really know what sections of it would need modifying to make static urls. Any ideas?

Thanks,
Shawn

Code: [ Select ]
<?
include ("config.php");
include ("include.php");
include ("lang.php");
session_start();
$c *= 1;
if ($c == 0) {    $c = 1;    };
$sql = mysql_query("SELECT name, title, description, pages, ref FROM {$prefix}categories WHERE id = $c");
$current_category = mysql_fetch_array($sql, MYSQL_ASSOC);
if (($c > 1) & !$current_category["name"]){
    header("Location: {$dir}index.php");
};
if (!$current_category["name"]) { $current_category["name"] = "Directory Search"; };
if (!$current_category["title"]) { $current_category["title"] = $current_category["name"]; };
if (!$current_category["description"]) { $current_category["description"] = $current_category["name"]." ".$current_category["title"]; };
$last_category = false;
$ref = $c;
while(!$last_category){
    $n_parent_categories += 1;
    $sql = mysql_query("SELECT id, name, ref FROM {$prefix}categories WHERE id = $ref");
    $parent_categories[$n_parent_categories-1] = mysql_fetch_array($sql, MYSQL_ASSOC);
    if ($parent_categories[$n_parent_categories-1]["ref"] == 0){
        $last_category = true;
    }else{
        $ref = $parent_categories[$n_parent_categories-1]["ref"];
    };
};
$sql = mysql_query("SELECT {$prefix}categories.id, {$prefix}categories.name, COUNT({$prefix}pages.id) AS pages FROM {$prefix}categories LEFT JOIN {$prefix}pages ON {$prefix}pages.category = {$prefix}categories.id AND {$prefix}pages.accepted = 'y' WHERE ref = $c GROUP BY {$prefix}categories.id ORDER BY {$prefix}categories.name");
$n_subcategories = mysql_num_rows($sql);
for ($x = 0; $x < $n_subcategories; $x++){
    $subcategories[$x] = mysql_fetch_array($sql, MYSQL_ASSOC);
};
$sql = mysql_query("SELECT {$prefix}categories.id, {$prefix}categories.name, COUNT({$prefix}subcategories.id) AS subcategories FROM {$prefix}categories LEFT JOIN {$prefix}categories AS {$prefix}subcategories ON {$prefix}subcategories.ref = {$prefix}categories.id WHERE {$prefix}categories.ref = $c GROUP BY {$prefix}categories.id ORDER BY {$prefix}categories.name");
for ($x = 0; $x < $n_subcategories; $x++){
    $subcategories[$x]["subcategories"] = mysql_result($sql, $x, "subcategories");
};

if ($current_category["pages"] == "y"){
    if ($s == 0) { $s = 1; };
    $n = 10;
    $sql = mysql_query("SELECT COUNT(*) AS total_pages FROM {$prefix}pages WHERE category = $c AND accepted = 'y'");
    $total_pages = mysql_result($sql,0,"total_pages");
    if ($total_pages > 0){
        $sql = mysql_query("SELECT id, url, title, description FROM {$prefix}pages WHERE category = $c AND accepted = 'y' ORDER BY title LIMIT ".($s-1).",$n");
        $n_pages = mysql_num_rows($sql);
        for ($x = 0; $x < $n_pages; $x++){
            $pages[$x] = mysql_fetch_array($sql, MYSQL_ASSOC);
        };
    };
};
$e = min($s + $n - 1, $s + $n_pages - 1);
?>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Wedding Vendors : <? echo $current_category["name"]; if ($current_category["title"] != $current_category["name"]){ echo " - ".$current_category["title"]; };?></TITLE>
<META NAME="description" CONTENT="<? echo $current_category["description"]?>">
<META NAME="keywords" CONTENT="<? echo $current_category["name"]." ".$current_category["description"]?>">
<SCRIPT TYPE="text/javascript" SRC="style.js"></SCRIPT>
</HEAD>
<BODY>
<?
include ("starting_html.php");
?>
<DIV CLASS="main">
<A HREF="http://vlib.org"> <IMG ALT="logo" SRC="VL.gif"> </A>
<CENTER> <H1>The World Wide Web Virtual Library: Weddings</H1> </CENTER>

<DIV CLASS="heading">
<H1><? echo $current_category["name"]?></H1>

<?
if ($c != 1){
    echo '<DIV CLASS="heading_path">'."\r\n";
    for ($x = $n_parent_categories-1; $x >= 1; $x--){
        if ($x != $n_parent_categories-1) { echo " > "; };
        if ($parent_categories[$x]["id"] == 1){
            echo '<A HREF="'.$dir.'index.php">'.$parent_categories[$x]["name"].'</A>';
        }else{
            echo '<A HREF="'.$dir.'index.php?c='.$parent_categories[$x]["id"].'">'.$parent_categories[$x]["name"].'</A>';
        };
    };
    echo ' > '.$current_category["name"];
    echo "</DIV>\r\n";
};
?>
</DIV>
<DIV CLASS="search">
<FORM METHOD="get" ACTION="search.php">
<DIV CLASS="search_controls">
<INPUT TYPE="text" NAME="q" MAXLENGTH=100 CLASS="search_controls_text">
<INPUT TYPE="submit" VALUE="<? echo $t02?>" CLASS="search_controls_button">
</DIV>
<?
if ($current_category["pages"] == "y" || $HTTP_SESSION_VARS['admin']){
    echo '<DIV CLASS="search_add">'."\r\n";
    if($current_category["pages"] == "y"){
        echo '<A HREF="'.$dir.'add_url.php?c='.$c.'">'.$t03.'</A>'."\r\n";
    };
    if($HTTP_SESSION_VARS['admin']){
        echo '<A HREF="'.$dir.'admin_edit.php?c='.$c.'">'.$t04.'</A>'."\r\n";
    };
    echo "</DIV>\r\n";
};
?>
</FORM>
</DIV>
<?
if ($n_subcategories > 0){
    echo '<DIV CLASS="categories">'."\r\n";
    echo '<DIV CLASS="categories_text">'.$t01.' "'.$current_category["name"].'":</DIV>'."\r\n";
    $t = ceil($n_subcategories/2);
    echo '<DIV CLASS="categories_blocks">'."\r\n";
    echo '<DIV CLASS="categories_blocks_left">'."\r\n";
    for ($x = 0; $x < $t; $x++){
        echo '<DIV CLASS="categories_category"><font size=3>» <DIV CLASS="categories_category_title"><A HREF="'.$dir.'index.php?c='.$subcategories[$x]["id"].'">'.$subcategories[$x]["name"].'</A></font> </DIV></DIV>'."\r\n";
    };
    echo "</DIV>\r\n";
    echo '<DIV CLASS="categories_blocks_right">'."\r\n";
    if ($n_subcategories > 1){
        for ($x = $t; $x < $n_subcategories; $x++){
            echo '<DIV CLASS="categories_category"><font size=3>» <DIV CLASS="categories_category_title"><A HREF="'.$dir.'index.php?c='.$subcategories[$x]["id"].'">'.$subcategories[$x]["name"].'</A></font> </DIV></DIV>'."\r\n";
        };
    }else{
        echo " \r\n";
    };
    echo "</DIV>\r\n";
    echo "</DIV>\r\n";
    echo "</DIV>\r\n";
};
if ($current_category["pages"] == "y"){
    if ($n_pages > 0){
        echo '<DIV CLASS="pages">'."\r\n";
        echo '<DIV CLASS="pages_results">'.$t05a.' '.$s.' - '.$e.' '.$t05b.' '.$total_pages.' '.$t05c.' "'.$current_category["name"].'":</DIV>'."\r\n";
        for ($x = 0; $x < $n_pages; $x++){
            echo '<DIV CLASS="pages_page">'."\r\n";
            echo '<DIV CLASS="pages_page_title"><A HREF="'.$pages[$x]["url"].'">'.$pages[$x]["title"].'</A></DIV>'."\r\n";
            echo '<DIV CLASS="pages_page_description">'.$pages[$x]["description"].'</DIV>'."\r\n";
            echo '<DIV CLASS="pages_page_url">'.$pages[$x]["url"].'</DIV>'."\r\n";
            echo "</DIV>\r\n";
        };
        echo "</DIV>\r\n";
    }else{
        echo '<DIV CLASS="pages">'."\r\n";
        echo '<DIV CLASS="pages_results">'.$t06.' "'.$current_category["name"].'"</DIV>'."\r\n";
        echo "</DIV>\r\n";
    };
    if ($s != 1 || $e != $total_pages){
        function query($s){
            global $c;
            if ($c != 1) { $query = "?c=$c"; };
            if (($c != 1) & $s != 1){
                $query .= "&s=$s";
            }elseif ($s != 1){
                $query = "?s=$s";
            };
            return $query;
        };
        echo '<DIV CLASS="options">'."\r\n";
        if ($s != 1){
            $previous = $s - $n;
            echo '<A HREF="'.$dir.'index.php'.query($previous).'">'.$t07.'</A>'."\r\n";
        };
        for ($x = 1; $x <= ceil($total_pages/$n); $x++){
            $current = ($x-1) * $n + 1;
            if ($current == $s){
                echo $x."\r\n";
            }else{
                echo '<A HREF="'.$dir.'index.php'.query($current).'">'.$x.'</A>'."\r\n";
            };
        };
        if ($e < $total_pages){
            $next = $s + $n;
            echo '<A HREF="'.$dir.'index.php'.query($next).'">'.$t08.'</A>'."\r\n";
        };
        echo "</DIV>\r\n";
    };
};
include ("links.php");
?>
</DIV>
<?
include ("ending_html.php");
?>
</BODY>
</HTML>
  1. <?
  2. include ("config.php");
  3. include ("include.php");
  4. include ("lang.php");
  5. session_start();
  6. $c *= 1;
  7. if ($c == 0) {    $c = 1;    };
  8. $sql = mysql_query("SELECT name, title, description, pages, ref FROM {$prefix}categories WHERE id = $c");
  9. $current_category = mysql_fetch_array($sql, MYSQL_ASSOC);
  10. if (($c > 1) & !$current_category["name"]){
  11.     header("Location: {$dir}index.php");
  12. };
  13. if (!$current_category["name"]) { $current_category["name"] = "Directory Search"; };
  14. if (!$current_category["title"]) { $current_category["title"] = $current_category["name"]; };
  15. if (!$current_category["description"]) { $current_category["description"] = $current_category["name"]." ".$current_category["title"]; };
  16. $last_category = false;
  17. $ref = $c;
  18. while(!$last_category){
  19.     $n_parent_categories += 1;
  20.     $sql = mysql_query("SELECT id, name, ref FROM {$prefix}categories WHERE id = $ref");
  21.     $parent_categories[$n_parent_categories-1] = mysql_fetch_array($sql, MYSQL_ASSOC);
  22.     if ($parent_categories[$n_parent_categories-1]["ref"] == 0){
  23.         $last_category = true;
  24.     }else{
  25.         $ref = $parent_categories[$n_parent_categories-1]["ref"];
  26.     };
  27. };
  28. $sql = mysql_query("SELECT {$prefix}categories.id, {$prefix}categories.name, COUNT({$prefix}pages.id) AS pages FROM {$prefix}categories LEFT JOIN {$prefix}pages ON {$prefix}pages.category = {$prefix}categories.id AND {$prefix}pages.accepted = 'y' WHERE ref = $c GROUP BY {$prefix}categories.id ORDER BY {$prefix}categories.name");
  29. $n_subcategories = mysql_num_rows($sql);
  30. for ($x = 0; $x < $n_subcategories; $x++){
  31.     $subcategories[$x] = mysql_fetch_array($sql, MYSQL_ASSOC);
  32. };
  33. $sql = mysql_query("SELECT {$prefix}categories.id, {$prefix}categories.name, COUNT({$prefix}subcategories.id) AS subcategories FROM {$prefix}categories LEFT JOIN {$prefix}categories AS {$prefix}subcategories ON {$prefix}subcategories.ref = {$prefix}categories.id WHERE {$prefix}categories.ref = $c GROUP BY {$prefix}categories.id ORDER BY {$prefix}categories.name");
  34. for ($x = 0; $x < $n_subcategories; $x++){
  35.     $subcategories[$x]["subcategories"] = mysql_result($sql, $x, "subcategories");
  36. };
  37. if ($current_category["pages"] == "y"){
  38.     if ($s == 0) { $s = 1; };
  39.     $n = 10;
  40.     $sql = mysql_query("SELECT COUNT(*) AS total_pages FROM {$prefix}pages WHERE category = $c AND accepted = 'y'");
  41.     $total_pages = mysql_result($sql,0,"total_pages");
  42.     if ($total_pages > 0){
  43.         $sql = mysql_query("SELECT id, url, title, description FROM {$prefix}pages WHERE category = $c AND accepted = 'y' ORDER BY title LIMIT ".($s-1).",$n");
  44.         $n_pages = mysql_num_rows($sql);
  45.         for ($x = 0; $x < $n_pages; $x++){
  46.             $pages[$x] = mysql_fetch_array($sql, MYSQL_ASSOC);
  47.         };
  48.     };
  49. };
  50. $e = min($s + $n - 1, $s + $n_pages - 1);
  51. ?>
  52. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  53. <HTML>
  54. <HEAD>
  55. <TITLE>Wedding Vendors : <? echo $current_category["name"]; if ($current_category["title"] != $current_category["name"]){ echo " - ".$current_category["title"]; };?></TITLE>
  56. <META NAME="description" CONTENT="<? echo $current_category["description"]?>">
  57. <META NAME="keywords" CONTENT="<? echo $current_category["name"]." ".$current_category["description"]?>">
  58. <SCRIPT TYPE="text/javascript" SRC="style.js"></SCRIPT>
  59. </HEAD>
  60. <BODY>
  61. <?
  62. include ("starting_html.php");
  63. ?>
  64. <DIV CLASS="main">
  65. <A HREF="http://vlib.org"> <IMG ALT="logo" SRC="VL.gif"> </A>
  66. <CENTER> <H1>The World Wide Web Virtual Library: Weddings</H1> </CENTER>
  67. <DIV CLASS="heading">
  68. <H1><? echo $current_category["name"]?></H1>
  69. <?
  70. if ($c != 1){
  71.     echo '<DIV CLASS="heading_path">'."\r\n";
  72.     for ($x = $n_parent_categories-1; $x >= 1; $x--){
  73.         if ($x != $n_parent_categories-1) { echo " > "; };
  74.         if ($parent_categories[$x]["id"] == 1){
  75.             echo '<A HREF="'.$dir.'index.php">'.$parent_categories[$x]["name"].'</A>';
  76.         }else{
  77.             echo '<A HREF="'.$dir.'index.php?c='.$parent_categories[$x]["id"].'">'.$parent_categories[$x]["name"].'</A>';
  78.         };
  79.     };
  80.     echo ' > '.$current_category["name"];
  81.     echo "</DIV>\r\n";
  82. };
  83. ?>
  84. </DIV>
  85. <DIV CLASS="search">
  86. <FORM METHOD="get" ACTION="search.php">
  87. <DIV CLASS="search_controls">
  88. <INPUT TYPE="text" NAME="q" MAXLENGTH=100 CLASS="search_controls_text">
  89. <INPUT TYPE="submit" VALUE="<? echo $t02?>" CLASS="search_controls_button">
  90. </DIV>
  91. <?
  92. if ($current_category["pages"] == "y" || $HTTP_SESSION_VARS['admin']){
  93.     echo '<DIV CLASS="search_add">'."\r\n";
  94.     if($current_category["pages"] == "y"){
  95.         echo '<A HREF="'.$dir.'add_url.php?c='.$c.'">'.$t03.'</A>'."\r\n";
  96.     };
  97.     if($HTTP_SESSION_VARS['admin']){
  98.         echo '<A HREF="'.$dir.'admin_edit.php?c='.$c.'">'.$t04.'</A>'."\r\n";
  99.     };
  100.     echo "</DIV>\r\n";
  101. };
  102. ?>
  103. </FORM>
  104. </DIV>
  105. <?
  106. if ($n_subcategories > 0){
  107.     echo '<DIV CLASS="categories">'."\r\n";
  108.     echo '<DIV CLASS="categories_text">'.$t01.' "'.$current_category["name"].'":</DIV>'."\r\n";
  109.     $t = ceil($n_subcategories/2);
  110.     echo '<DIV CLASS="categories_blocks">'."\r\n";
  111.     echo '<DIV CLASS="categories_blocks_left">'."\r\n";
  112.     for ($x = 0; $x < $t; $x++){
  113.         echo '<DIV CLASS="categories_category"><font size=3>» <DIV CLASS="categories_category_title"><A HREF="'.$dir.'index.php?c='.$subcategories[$x]["id"].'">'.$subcategories[$x]["name"].'</A></font> </DIV></DIV>'."\r\n";
  114.     };
  115.     echo "</DIV>\r\n";
  116.     echo '<DIV CLASS="categories_blocks_right">'."\r\n";
  117.     if ($n_subcategories > 1){
  118.         for ($x = $t; $x < $n_subcategories; $x++){
  119.             echo '<DIV CLASS="categories_category"><font size=3>» <DIV CLASS="categories_category_title"><A HREF="'.$dir.'index.php?c='.$subcategories[$x]["id"].'">'.$subcategories[$x]["name"].'</A></font> </DIV></DIV>'."\r\n";
  120.         };
  121.     }else{
  122.         echo " \r\n";
  123.     };
  124.     echo "</DIV>\r\n";
  125.     echo "</DIV>\r\n";
  126.     echo "</DIV>\r\n";
  127. };
  128. if ($current_category["pages"] == "y"){
  129.     if ($n_pages > 0){
  130.         echo '<DIV CLASS="pages">'."\r\n";
  131.         echo '<DIV CLASS="pages_results">'.$t05a.' '.$s.' - '.$e.' '.$t05b.' '.$total_pages.' '.$t05c.' "'.$current_category["name"].'":</DIV>'."\r\n";
  132.         for ($x = 0; $x < $n_pages; $x++){
  133.             echo '<DIV CLASS="pages_page">'."\r\n";
  134.             echo '<DIV CLASS="pages_page_title"><A HREF="'.$pages[$x]["url"].'">'.$pages[$x]["title"].'</A></DIV>'."\r\n";
  135.             echo '<DIV CLASS="pages_page_description">'.$pages[$x]["description"].'</DIV>'."\r\n";
  136.             echo '<DIV CLASS="pages_page_url">'.$pages[$x]["url"].'</DIV>'."\r\n";
  137.             echo "</DIV>\r\n";
  138.         };
  139.         echo "</DIV>\r\n";
  140.     }else{
  141.         echo '<DIV CLASS="pages">'."\r\n";
  142.         echo '<DIV CLASS="pages_results">'.$t06.' "'.$current_category["name"].'"</DIV>'."\r\n";
  143.         echo "</DIV>\r\n";
  144.     };
  145.     if ($s != 1 || $e != $total_pages){
  146.         function query($s){
  147.             global $c;
  148.             if ($c != 1) { $query = "?c=$c"; };
  149.             if (($c != 1) & $s != 1){
  150.                 $query .= "&s=$s";
  151.             }elseif ($s != 1){
  152.                 $query = "?s=$s";
  153.             };
  154.             return $query;
  155.         };
  156.         echo '<DIV CLASS="options">'."\r\n";
  157.         if ($s != 1){
  158.             $previous = $s - $n;
  159.             echo '<A HREF="'.$dir.'index.php'.query($previous).'">'.$t07.'</A>'."\r\n";
  160.         };
  161.         for ($x = 1; $x <= ceil($total_pages/$n); $x++){
  162.             $current = ($x-1) * $n + 1;
  163.             if ($current == $s){
  164.                 echo $x."\r\n";
  165.             }else{
  166.                 echo '<A HREF="'.$dir.'index.php'.query($current).'">'.$x.'</A>'."\r\n";
  167.             };
  168.         };
  169.         if ($e < $total_pages){
  170.             $next = $s + $n;
  171.             echo '<A HREF="'.$dir.'index.php'.query($next).'">'.$t08.'</A>'."\r\n";
  172.         };
  173.         echo "</DIV>\r\n";
  174.     };
  175. };
  176. include ("links.php");
  177. ?>
  178. </DIV>
  179. <?
  180. include ("ending_html.php");
  181. ?>
  182. </BODY>
  183. </HTML>

Post Information

  • Total Posts in this topic: 10 posts
  • Users browsing this forum: Bigwebmaster and 65 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.