Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-29-2005, 12:20 AM
Joe Pimms Joe Pimms is offline
 
Join Date: Jan 2005
Location: Canada
Posts: 95
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default <if condition=> help please

hey i have a question for all you php coders

im working on a vbhack that improrting from another script my question is this
in the script im working on have all the templates in the .php scripts and in the scripts there are a few areas that have this in it

PHP Code:
<table width="140" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#86A4C6">
            <tr>
              <td background="bgMenu.gif">
                <div align="center"><strong>Stats</strong></div></td>
            </tr>
            <tr class="categoriesbox_transparentborder">
              <td bgcolor="#f5f7fa" class="categoriesbox_text"><div align="center">Serials in DB: <?php getindb();?><br>
                Total Serial Views: <?php gettotalviews();?></div></td>
            </tr>
          </table>
PHP Code:
<?php gettotalviews();?>
its these thing im wondering when i make the template how i can keep this same function to work in the script as im going to remove all the other thing and leave the php code in the php tags

could i use the
PHP Code:
<if condition=> 
or ?

please help me
Reply With Quote
  #2  
Old 01-29-2005, 12:57 AM
Guy G Guy G is offline
 
Join Date: Nov 2004
Posts: 250
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you will need to put in the php script something like
gettotalviews() = $gettotalviews

Than on the template you put $gettotalviews where the gettotalviews() was..

a if is just a conditional.
Reply With Quote
  #3  
Old 01-29-2005, 10:00 AM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

in your php file put:

PHP Code:
$gettotalviews gettotalviews(); 
And put $gettotalviews in the template where you have your current phpcode
Reply With Quote
  #4  
Old 01-29-2005, 03:32 PM
Joe Pimms Joe Pimms is offline
 
Join Date: Jan 2005
Location: Canada
Posts: 95
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

so would the script look like this then ?
in the php script:
PHP Code:
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS'1);
define('THIS_SCRIPT''serial');
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
require
"config_serial.php";
require
"functions_serial.php";
// ########################################################################
?>

<script src="./sys.js"></script>
<?php
$getindb 
getindb();   
$gettotalviews gettotalviews();
$advsbox advsbox();
$gettitle gettitle(40);
$getserials getserials(40,40,40);
$pagelinks pagelinks();

eval(
'$navbar = "' fetch_template('navbar') . '";');
eval(
'print_output("' fetch_template('serials') . '");');
?>
and here is the template:
PHP Code:
$stylevar[htmldoctype]
<
html dir="$stylevar[textdirection]lang="$stylevar[languagecode]">
<
head>
<
title>YourSiteTitle</title>
<
script src="./sys.js"></script>
$headinclude
</head>
<
body>
$header
$navbar
<table class="tborder" cellpadding="$stylevar[cellpadding]cellspacing="$stylevar[cellspacing]border="0" width="80%" align="center">
<
thead>
    <
tr>
        <
td class="tcat" colspan="2">$vbphrase[serial_system]</td>
    </
tr>
</
thead>    <tr
      <
td width="155" height="327" valign="top"> <div align="center"><br>
          <
br>
          <
table width="140" border="0" align="center" cellpadding="0" cellspacing="1">
                        <
tr
              <
td class="thead" width="175">$vbphrase[Navigation_serial]</td>            </tr>
            <
tr class="categoriesbox_transparentborder"
              <
td class="categoriesbox_text">              <strong><a href="add_serial.php" target="_blank">Add Serial</a></strong></td>
            </
tr>
          </
table>
          <
br>
          <
br>
          <
table width="140" border="0" align="center" cellpadding="0" cellspacing="1">
            <
tr>
             <
td class="thead" width="175">$vbphrase[stats_serial]</td>            </tr>
            <
tr class="categoriesbox_transparentborder">
              <
td class="categoriesbox_text"><div align="center">Serials in DB$getindb<br>
                
Total Serial Views$gettotalviews</div></td>
            </
tr>
          </
table>
          <
br>
          </
div></td>
      <
td width="624" valign="top"><div align="center"><br>
           
$advsbox
          
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="1">
            <
tr
            <
td colspan="5" background="bgMenu.gif"><div align="center"><strong>$gettitle</strong></div></td>
            </
tr>
        <
td class="thead" width="175">$vbphrase[Software_Name]</td>
<
td class="thead" width="175">$vbphrase[Date_serial]</td>
<
td class="thead" width="175">$vbphrase[Views_serial]</td>
<
td class="thead" width="175">$vbphrase[Working_in]</td>
             </
tr>
             
$getserials
            $pagelinks
            
<tr class="categoriesbox_transparentborder"
              <
td colspan="5" class="categoriesbox_text"></td>
            </
tr>
          </
table>
</
div></td>
    </
tr>
  </
table>
$footer
</body>
</
html
cause this is the real one im working on here below

PHP Code:
<?php 
require"config.php";
require
"functions.php";
?>
<html>
<head>
<title>YourSiteTitle</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="serials.css" rel="stylesheet" type="text/css">
<script src="./sys.js"></script>
</head>
<style>
a:link        {color: #0F51C6; text-decoration: none}
a:active    {color: #0F51C6; text-decoration: none}
a:visited    {color: #0F51C6; text-decoration: none}
a:hover        {color: #000000; text-decoration: none}
.box        {color: #193A4D; border: 1px solid #D0D5D9; background-color: #F3F4F5; font-family:Verdana; font-size:8pt}
td        {font-family: Tahoma; font-size: 8pt}
body        {font-family: Tahoma; font-size: 8pt; scrollbar-face-color: #F3F4F5;scrollbar-shadow-color: #ADB6BC; scrollbar-highlight-color: #ADB6BC; scrollbar-3dlight-color: #F3F4F5; scrollbar-darkshadow-color: #F3F4F5; scrollbar-track-color: #FFFFFF; scrollbar-arrow-color: #ADB6BC}
.carea        { font-size: 11px; line-height: 24px; color: #878787; letter-spacing: -1; }
.smallblack    { font-size: 10px; color: #000000; letter-spacing: -1; }
.sidelink    { font-size: 10px; color: #686868; letter-spacing: -1; }
</style>
<body>
<div align="center"> 
  <table width="650" height="349" border="0" cellpadding="0" cellspacing="1" bgcolor="#86A4C6">
    <tr> 
      <td height="19" colspan="2" valign="top" bgcolor="#f5f7fa"> 
<div align="center">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr> 
              <td height="65" background="rightoflogo.jpg"> <div align="center"> 
                  <table width="780" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td width="210" height="20"><div align="center"></div></td>
                      <td width="359" rowspan="3"> <div align="center"></div></td>
                      <td width="211" height="20"><div align="center"></div></td>
                    </tr>
                    <tr> 
                      <td width="210" height="11"><img src="blank.gif" width="1" height="11"></td>
                      <td width="211" height="11"><img src="blank.gif" width="1" height="13"></td>
                    </tr>
                    <tr> 
                      <td width="210" height="32"> <div align="center"><font size="1"><img src="arrow.gif" width="9" height="8"> 
                          <strong><a href="javascript:window.external.AddFavorite('http://www.url.com/','YOURSITETITLE')">Bookmark 
                          Us</a><img src="blank.gif" width="8" height="1"> </strong><img src="arrow.gif" width="9" height="8"> 
                          <strong><a href="javascript:setHomepage()" onClick="this.style.behavior='url(#default#homepage)'; this.setHomePage ('http://www.url.com/');"><span class="maintext">Make 
                          HomePage</span></a></strong></font></div></td>
                      <td width="211" height="32"> <div align="center"><font size="1"><strong>Todays 
                          Date:</strong> 
                          <script language="JavaScript">
  <!--

  var font="verdana";
  var fsize="2";
  var now=new Date();
  var month="";
  var year="";
  var date=now.getDate();

    if(now.getMonth()==0)month="January"
    if(now.getMonth()==1)month="February"
    if(now.getMonth()==2)month="March"
    if(now.getMonth()==3)month="April"
    if(now.getMonth()==4)month="May" 
    if(now.getMonth()==5)month="June"
    if(now.getMonth()==6)month="July"
    if(now.getMonth()==7)month="August"
    if(now.getMonth()==8)month="September"
    if(now.getMonth()==9)month="October"
    if(now.getMonth()==10)month="November"
    if(now.getMonth()==11)month="December"
    if(now.getYear()<100)year="19"+now.getYear()
    if(now.getYear()>=100)var year="2003"
  
  document.write('<font size="1" face="verdana" " color="#000000">'+month+" "+date+", "+year)

  //-->
          </script>
                          </font></div></td>
                    </tr>
                  </table>
                </div></td>
            </tr>
          </table>
</div></td>
    </tr>
    <tr> 
      <td width="155" height="327" valign="top" bgcolor="#f5f7fa"> <div align="center"><br>
          <table width="140" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#86A4C6">
            <tr>
              <td background="bgMenu.gif">
                <div align="center"><strong>Search Serials </strong></div></td>
            </tr>
            <tr class="categoriesbox_transparentborder">
              <form action="?" method="post"><td bgcolor="#f5f7fa" class="categoriesbox_text">
                <input name="q" type="text" class="box" size="15">
              <input type="submit" class="box" value="Go"></td></form>
            </tr>
          </table>
          <br>
          <table width="140" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#86A4C6">
            <tr> 
              <td background="bgMenu.gif"> <div align="center"><strong>Navigation 
                  </strong></div></td>
            </tr>
            <tr class="categoriesbox_transparentborder"> 
              <td bgcolor="#f5f7fa" class="categoriesbox_text"><a href="./">Home / Top 20</a><br> 
                <a href="?do=advs">Advanced Search</a><br>
              <a href="?do=browse">Browse By Added</a><br>
              <strong><a href="add.php" target="_blank">Add Serial</a></strong></td>
            </tr>
          </table>
          <br>
          <table width="140" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#86A4C6">
            <tr>
              <td background="bgMenu.gif">
                <div align="center"><strong>List By </strong></div></td>
            </tr>
            <tr class="categoriesbox_transparentborder">
              <td bgcolor="#f5f7fa" class="categoriesbox_text"><div align="center"><a href="?list=1">#</a> <a href="?list=a">A</a> <a href="?list=b">B</a> <a href="?list=c">C</a> <a href="?list=d">D</a> <a href="?list=e">E</a> <a href="?list=f">F</a> <a href="?list=g">G</a> <a href="?list=h">H</a> <a href="?list=i">I</a> <a href="?list=j">J</a> <a href="?list=k">K</a> <a href="?list=l">L</a> <a href="?list=m">M</a> <br>
                  <a href="?list=n">N</a> <a href="?list=o">O</a> <a href="p">P</a> <a href="?list=q">Q</a> <a href="?list=r">R</a> <a href="?list=s">S</a> <a href="?list=t">T</a>  <a href="?list=u">U</a> <a href="?list=v">V</a> <a href="?list=w">W</a> <a href="?list=x">X</a> <a href="?list=y">Y</a> <a href="?list=z">Z</a></div></td>
            </tr>
          </table>
          <br>
          <table width="140" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#86A4C6">
            <tr>
              <td background="bgMenu.gif">
                <div align="center"><strong>Stats</strong></div></td>
            </tr>
            <tr class="categoriesbox_transparentborder">
              <td bgcolor="#f5f7fa" class="categoriesbox_text"><div align="center">Serials in DB: <?php getindb();?><br>
                Total Serial Views: <?php gettotalviews();?></div></td>
            </tr>
          </table>
          <br>
          <table width="140" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#86A4C6">
            <tr> 
              <td background="bgMenu.gif"> <div align="center"><strong>Partners 
                  / Affiliates</strong></div></td>
            </tr>
            <tr class="categoriesbox_transparentborder"> 
              <td bgcolor="#f5f7fa" class="categoriesbox_text"> <div align="center"><br>
                </div></td>
            </tr>
          </table>
</div></td>
      <td width="624" valign="top" bgcolor="#f5f7fa"><div align="center"><br>
          <?php advsbox();?>
          <table width="90%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#86A4C6">
            <tr> 
            <td colspan="5" background="bgMenu.gif"><div align="center"><strong><?php gettitle(40);/*First = Top...Serials on main page*/?></strong></div></td>
            </tr>
            <tr bgcolor="#f5f7fa">
              <td bgcolor="#f5f7fa">Software Name </td>
              <td bgcolor="#f5f7fa">Date</td>
              <td bgcolor="#f5f7fa">Views</td>
              <td bgcolor="#f5f7fa">Working in %</td>
            </tr>
            <?php getserials(40,40,40);/*First=Frontpage(top..),Second=#-Z(list..)+Browse,Third=SearchResults*/?>
            <?php pagelinks();?>
            <tr class="categoriesbox_transparentborder"> 
              <td colspan="5" bgcolor="#f5f7fa" class="categoriesbox_text"></td>
            </tr>
          </table>
</div></td>
    </tr>
  </table>
</body>
</html>
please help
Reply With Quote
  #5  
Old 01-29-2005, 11:44 PM
miz miz is offline
 
Join Date: Mar 2003
Posts: 416
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

well
if i got you right then its dosent show vb header and footer or things like that
right ?

so in the function gettotalviews();

add

PHP Code:
global $header,$footer,$headinclude
should work if this is your problem
i had this problem in my one of my hacks

btw this will work only if the function call to template.
Reply With Quote
  #6  
Old 01-30-2005, 12:39 AM
Joe Pimms Joe Pimms is offline
 
Join Date: Jan 2005
Location: Canada
Posts: 95
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

where in my script do i put this can you give me a example please ?

Quote:
Originally Posted by miz
well
if i got you right then its dosent show vb header and footer or things like that
right ?

so in the function gettotalviews();

add

PHP Code:
global $header,$footer,$headinclude
should work if this is your problem
i had this problem in my one of my hacks

btw this will work only if the function call to template.
Reply With Quote
  #7  
Old 01-30-2005, 12:42 AM
miz miz is offline
 
Join Date: Mar 2003
Posts: 416
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

where you have
function gettotalviews

but i think i just got you worng
so if you can explain your problem again
i might be able to help you more
Reply With Quote
  #8  
Old 01-30-2005, 03:07 AM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can also embed PHP in HTML language, with a simpe tag like:
<script type="php"></script>
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:37 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04470 seconds
  • Memory Usage 2,329KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (9)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete