/[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.3 - (hide annotations)
Mon Jul 9 13:40:26 2001 UTC (17 years, 10 months ago) by dpavlin
Branch: MAIN
Changes since 1.2: +9 -2 lines
multi page final

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 dpavlin 1.2 $sql="select id,menu_num,name,html,path,type from multi where visible and id=$p";
17 dpavlin 1.1 $sth = $dbh->prepare("$sql");
18     $sth->execute();
19     $row=$sth->fetchrow_hash();
20    
21     $title.=" : $row[name]";
22 dpavlin 1.2 if ($row[type]=="h" && file_exists(find_html_file("multi",$row[html]))) {
23 dpavlin 1.1 $main=join('',file(find_html_file("multi",$row[html])));
24 dpavlin 1.3 } elseif ($row[type]=="p") {
25     if (file_exists(find_html_file("",$row[path]))) {
26     $main=join('',file(find_html_file("",$row[path])));
27     } else {
28     $main="<b>can't find $row[path] for id $p</b>";
29     }
30 dpavlin 1.2 // try to load translation (html fix-up or something)
31     $fix_up="./fix_up/".str_replace("/","_",dirname($row[path])).".inc";
32 dpavlin 1.3
33     # $main.="<!-- trying to use fixup $fix_up -->"; ## DEBUG
34 dpavlin 1.2 if (file_exists($fix_up)) {
35     include($fix_up);
36 dpavlin 1.3 # $main.="<!-- fixup: $fix_up -->"; ## DEBUG
37 dpavlin 1.2 }
38 dpavlin 1.1 } else {
39     $main="<b>can't find multi page for id $p</b>";
40     }
41    
42     // fetch section
43     $sql="select section,item from menu where num=$row[menu_num]";
44     $sth = $dbh->prepare("$sql");
45     $sth->execute();
46     $menu_row=$sth->fetchrow_hash();
47     $section=$menu_row[section];
48     $title=" : $menu_row[item] $title";
49     $title=str_replace("\\n"," ",$title); // nuke nl chars
50    
51     // fetch all pages in this multi-page
52     $sql="select id,name from multi where visible and menu_num=$row[menu_num] order by menu_num,num";
53     $sth = $dbh->prepare("$sql");
54     $sth->execute();
55    
56     $multi_page_url=array();
57     $multi_page_options=array();
58     $multi_page_id=array();
59     $max=0;
60     while ($row=$sth->fetchrow_hash()) {
61     array_push($multi_page_url,"$PHP_SELF?p=$row[id]");
62     array_push($multi_page_id,$row[id]);
63     $multi_page_options[$row[id]]=$row[name];
64     #array_push($multi_page_options,array( value=>$row[id], output=>$row[name]));
65     if ($row[id] == $p) {
66     $current=$max;
67     $curr_id=$row[id];
68     }
69     $max++;
70     }
71     $smarty->assign(array(
72     "multi_page_show" => 1,
73     "multi_page_current"=>($current+1),
74     "multi_page_max"=>$max,
75     "multi_page_prev"=>$multi_page_url[$current-1],
76     "multi_page_next"=>$multi_page_url[$current+1],
77     "multi_page_options"=>$multi_page_options,
78     "multi_page_curr_id"=>$curr_id
79     ));
80     }
81    
82     require("inc/section.php");
83     include("common.inc");
84    
85     $smarty->assign(array(section=>$section,
86     mpic=>$mpic,
87     Section_title=>$title,
88     rnd=>$rnd,
89     MAIN=>$main,
90     ));
91    
92     $smarty->display("index.tpl");
93     ?>

  ViewVC Help
Powered by ViewVC 1.1.26