/[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.4 - (hide annotations)
Tue Jul 10 07:50:34 2001 UTC (22 years, 8 months ago) by dpavlin
Branch: MAIN
Changes since 1.3: +6 -2 lines
limit za dužinu title-a u drop-down meniju

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

  ViewVC Help
Powered by ViewVC 1.1.26