/[corp_html]/new.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 /new.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations)
Thu Feb 22 09:51:19 2001 UTC (21 years, 11 months ago) by dpavlin
Branch: MAIN
Changes since 1.2: +27 -15 lines
news improvements

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 d.d." ) );
8    
9    
10     if (isset($from)) {
11     $section=$from;
12     } else {
13     $section="new";
14     }
15    
16     if ($section == "investor") {
17     $title="INVESTOR'S PAGE";
18     $lpic="investor"; $lext=".jpg";
19     $mpic="investors.gif";
20     $back_url="investor.php";
21     } else {
22     $title="What's New";
23     $lpic="new"; $lext=".jpg";
24     $mpic="new.gif";
25     $back_url="index.php";
26     }
27    
28     $smarty->assign( array ( lpic=>$lpic, lext=>$lext, mpic=>$mpic, Section_title=>$title ) );
29    
30 dpavlin 1.2 $sql_where="where visible is true";
31 dpavlin 1.1
32 dpavlin 1.3 function find_html_file($dir,$file) {
33     $file="./$dir/$file";
34     if (is_file("$file") && file_exists("$file")) { return "$file"; }
35     if (is_file("$file.htm") && file_exists("$file.htm")) { return "$file.htm"; }
36     if (is_file("$file.html") && file_exists("$file.html")) { return "$file.html"; }
37     return 0;
38 dpavlin 1.1 }
39    
40 dpavlin 1.3 if (file_exists(find_html_file("news",$more))) {
41 dpavlin 1.1
42 dpavlin 1.3 $main=join('',file(find_html_file("news",$more)));
43     $back_url=$GLOBALS[HTTP_REFERER];
44    
45     } else {
46     if (isset($id)) {
47     $sql_where.=" and id=$id ";
48     }
49    
50     $sth = $dbh->prepare("select id,title,town_date,body,more,pdf from news $sql_where order by id desc");
51     $sth->execute();
52     while ($row=$sth->fetchrow_hash()) {
53     $data[]=$row;
54     }
55 dpavlin 1.1
56 dpavlin 1.3 $smarty->assign("data",$data);
57 dpavlin 1.1
58 dpavlin 1.3 $main=$smarty->fetch("new.tpl");
59 dpavlin 1.1
60 dpavlin 1.3 if (isset($id) && find_html_file("news",$data[0][more])) {
61     $main=join('',file(find_html_file("news",$data[0][more])));
62     }
63 dpavlin 1.1
64 dpavlin 1.3 if ($main == "") {
65     $main = "This news item is no longer available";
66 dpavlin 1.1 }
67    
68     }
69    
70     include("common.inc");
71     $smarty->assign( array(back_url=>$back_url, MAIN=>$main));
72    
73     $smarty->display("index.tpl");
74     ?>

  ViewVC Help
Powered by ViewVC 1.1.26