/[pliva-si]/multi.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /multi.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Tue Jul 3 12:41:05 2001 UTC (22 years, 8 months ago) by dpavlin
Branch: MAIN
multi-page support

1 dpavlin 1.1 <?php
2     require("Smarty.class.php");
3     require("conn.inc");
4    
5     $smarty = new Smarty;
6    
7     $smarty->assign( array ( Title=>"PLIVA Ljubljana" ) );
8    
9     include("find_html_file.inc");
10    
11     if (! isset($p)) {
12     $p=0;
13     $section="domov";
14     } else {
15     // fetch current page
16     $sql="select id,menu_num,name,html from multi where visible and id=$p";
17     $sth = $dbh->prepare("$sql");
18     $sth->execute();
19     $row=$sth->fetchrow_hash();
20    
21     $title.=" : $row[name]";
22     if (file_exists(find_html_file("multi",$row[html]))) {
23     $main=join('',file(find_html_file("multi",$row[html])));
24     } else {
25     $main="<b>can't find multi page for id $p</b>";
26     }
27    
28     // fetch section
29     $sql="select section,item from menu where num=$row[menu_num]";
30     $sth = $dbh->prepare("$sql");
31     $sth->execute();
32     $menu_row=$sth->fetchrow_hash();
33     $section=$menu_row[section];
34     $title=" : $menu_row[item] $title";
35     $title=str_replace("\\n"," ",$title); // nuke nl chars
36    
37     // fetch all pages in this multi-page
38     $sql="select id,name from multi where visible and menu_num=$row[menu_num] order by menu_num,num";
39     $sth = $dbh->prepare("$sql");
40     $sth->execute();
41    
42     $multi_page_url=array();
43     $multi_page_options=array();
44     $multi_page_id=array();
45     $max=0;
46     while ($row=$sth->fetchrow_hash()) {
47     array_push($multi_page_url,"$PHP_SELF?p=$row[id]");
48     array_push($multi_page_id,$row[id]);
49     $multi_page_options[$row[id]]=$row[name];
50     #array_push($multi_page_options,array( value=>$row[id], output=>$row[name]));
51     if ($row[id] == $p) {
52     $current=$max;
53     $curr_id=$row[id];
54     }
55     $max++;
56     }
57     $smarty->assign(array(
58     "multi_page_show" => 1,
59     "multi_page_current"=>($current+1),
60     "multi_page_max"=>$max,
61     "multi_page_prev"=>$multi_page_url[$current-1],
62     "multi_page_next"=>$multi_page_url[$current+1],
63     "multi_page_options"=>$multi_page_options,
64     "multi_page_curr_id"=>$curr_id
65     ));
66     }
67    
68     require("inc/section.php");
69     include("common.inc");
70    
71     $smarty->assign(array(section=>$section,
72     mpic=>$mpic,
73     Section_title=>$title,
74     rnd=>$rnd,
75     MAIN=>$main,
76     ));
77    
78     $smarty->display("index.tpl");
79     ?>

  ViewVC Help
Powered by ViewVC 1.1.26