vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   php replacement variables (https://vborg.vbsupport.ru/showthread.php?t=79316)

akanevsky 04-08-2005 10:54 PM

I cannot help you until I know what exactly do you want to see as a result.

Lizard King 04-08-2005 11:02 PM

I have a shoutbox module for vbadvanced Cmps. The module is really simple. It only uses 1 php file and 1 template.
Here is the php file :
Code:

<?php

###########################################################################
##  MAJESTIC FORUM SHOUTBOX
###########################################################################

###########################################################################
##  REQUIRE BACK-END
###########################################################################

      require_once('./global.php');

        function check($var,$link)
        {
        $var = trim($var);
        if(empty($var))
        {
        header("Location: $link");
        }
        }
       
        function swear()
        {
        global $comment;
        $swears["++++"] = "++++";
        $swears["++++ing"] = "++++ing";
        $swears["++++"] = "++++";
        $swears["+++++"] = "+++++";
        while(list($text,$image) = each($swears))
        {
        $comment = str_replace("$text","$image","$comment");
        }
        return $comment;
        }

        function replace_text_smiley() {
        global $comment;
        $faces["text smiley here"] = "img tag to image smile here";
        $faces[":lol:"] = "<img src=\"http://forum.ayyas.com/images/smilies/cool.gif \" alt=\"Cool\">";
        while(list($text,$image) = each($faces))  {
        $comment = str_replace("$text","$image","$comment");
        }
        return $comment;
        }

###########################################################################
##  CONDITION ONE
###########################################################################
       
            $is = "view";
            if(isset($setting) && !empty($setting) && $setting == "save") {
       
###########################################################################
##  HEAD INFO
###########################################################################

            $back = $HTTP_REFERER;

###########################################################################
##  CHECK DO
###########################################################################

            if($is == "ref") {
            header("Location: shoutbox.php");
            }

###########################################################################
##  CHECK SHOUTBOX STOP NON REGISTERED POSTING
###########################################################################



            check($name,$back);
            check($comment,$back);
            if($bbuserinfo[username]!=$name || $bbuserinfo[userid]==1)
            {

            ?>
            <font face="Verdana" size="1">
            <?echo('Vur Kac a yazabilmeniz icin kayit olmaniz gerekiyor.');?>
            </font>
            <?
            exit;
            }
       
###########################################################################
##  SAVES SHOUTBOX
###########################################################################       

            $user=$bbuserinfo[userid];
            if(!mysql_query("INSERT INTO adv_shoutbox (name,comment,postuserid) VALUES          ('$name','$comment','$user')")) {
            $url = 'shoutbox.php?is=save';
            header("Location: $url");
               
            } else {

###########################################################################
##  LIMIT SHOUTS TO STOP IT FILLING DATABASE [$maxi - 100] <--- CHANGE THIS TO YOUR LIMIT
###########################################################################       
               
            $res = mysql_query("SELECT max(id) FROM adv_shoutbox");
            $maxi = mysql_result($res, 0);
            mysql_query("DELETE FROM adv_shoutbox WHERE id < ($maxi - 200)");
            header("Location: shoutbox.php");
            }
            }

            if(empty($setting) || $setting == "view") {

###########################################################################
##  DISPLAY SHOUTS FROM TABLE
###########################################################################

            $result = mysql_query("SELECT * FROM adv_shoutbox ORDER BY id DESC LIMIT 100") or die (mysql_error());
            $num_res = mysql_num_rows($result);
            if($num_res == "0") {
            echo 'There are no shouts yet.';
            ?>

            <form action="shoutbox.php" method="post">
            <input type="hidden" name="setting" value="save">
            <input type="text" name="name" value="name">
            <br /><input type="text" name="comment" value="comment">
            <br /><input type="submit" value="Shout"></form>

            <?

            } else {

            while ($get = mysql_fetch_row($result)) {
            $name = $get[1];
            $comment = $get[2];
            $postuserid = $get[3];
            $name = strip_tags($name);
            $comments = strip_tags($comments);
            $comment = nl2br($comment);
            replace_text_smiley();
            swear();


###########################################################################
##  SET YOUR OWN COLOURS HERE
###########################################################################
                       
                        ?>
                        <body bgcolor="#060606" text="#999999" link="#ff0000" alink="#ff0000" vlink="#ff0000">
            <font face="verdana" size="1"><a href="member.php?u=<? echo "$postuserid"; ?>" target="blank">
            <b><? echo "$name"; ?></b></a><br><? echo "$comment"; ?><br><br></font></body>
                       
            <?
            }
            }
            }

###########################################################################
##  CONDITION THREE BAN ERROR
###########################################################################       

        if($is == "ban") {
        echo 'You are banned from the shoutbox. So just leave now.';
        exit;
        }

###########################################################################
##  CONDITION FOUR ERROR ON SHOUT
###########################################################################

          if($is == "save") {
          echo 'There was an error in saving your shoutbox.';
          exit;
          }

###########################################################################
##  MAJESTIC FORUM SHOUTBOX
###########################################################################

?>

and the template it is using is :

Code:

<!-- Shoutbox -->

<script type="text/javascript">
var timer_id;
function scroll_iframe(frm,inc,dir) {
  if (timer_id) clearTimeout(timer_id);
  if (window.frames[frm]) {
    if (dir == "v") window.frames[frm].scrollBy(0, inc);
    else window.frames[frm].scrollBy(inc, 0);
    timer_id = setTimeout("scroll_iframe('" + frm + "'," + inc + ",'" + dir + "')", 20);
  }
}
function stopScroll() { if (timer_id) clearTimeout(timer_id); }
</script>

<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder"width="100%">
<tr><td class="tcat"><span class="smallfont"><strong>$vba_options[portal_blockbullet] $mods[title]</strong></span>
<a href="javascript:;" onmouseover="scroll_iframe('shoutbox', -4, 'v'); window.status='Hover here to scroll up.'; return true" onmouseout="stopScroll(); window.status=''; return true"><img src="http://forum.ayyas.com/images/tri-up.gif" valign="top" align="right" width="12" height="12" alt="Yukarı" border="0"></a></td></tr>

<tr><td class="alt1"><span class="smallfont">
<DIV ID=oDiv STYLE="width: 158px; height: 254px; overflow: hidden;">
<iframe class="alt1" marginwidth="2" marginheight="2" name="shoutbox" noresize scrolling="no" align="middle" frameborder="0" height="250" width="100%" src="forum/shoutbox.php" id="shoutbox"></iframe></DIV>
<form action="forum/shoutbox.php" method="post" target="shoutbox">
<input type="hidden" name="setting" value="save" />
<input type="hidden" name="name" value="$bbuserinfo[username]" size="20" />
<input type="text" name="comment" value="eşeğim ben" size="20" maxlength="100" /><br>
<input class="button" type="submit" value="Bağır ?ağır" /></form></span>
<a href="javascript:;" onmouseover="scroll_iframe('shoutbox', 4, 'v'); window.status='Hover here to scroll down.'; return true" onmouseout="stopScroll(); window.status=''; return true"><img src="//forum.ayyas.com/images/tri-dn.gif" valign="top" align="right" width="12" height="12" alt="Aşağı" border="0"></a></td></tr></table><br />

<!-- Shoutbox -->

You can see it here : www.ayyas.com it matches the style cause i can edit it from the php file but i have other styles and there is no way i can get it working.
check another style to see : http://www.ayyas.com/?styleid=39

why-not 04-09-2005 12:57 AM

Hi


You are calling a include on './global.php'

So you have all your style var(s) ready to be accessed! I don't know what CSS style var(s) you want to use, but you can decide by just doing this!

To see what colors you want to use....

PUT THIS IN YOUR SCRIPT!

Code:


print_r ( $stylevar );

That will print an array like this! (example only contains a few elements of the array)

Code:

Array
(
    [body_fgcolor] => #2d24c6
    [page_bgcolor] => #ffffff
    [page_fgcolor] => #B9B9B9
    [tborder_bgcolor] => #7a89ea
    [tborder_fgcolor] => #ffffff
    [tcat_bgcolor] => #7a89ea
    [tcat_fgcolor] => #f9f95b
    [thead_bgcolor] => #fafa86
    [thead_fgcolor] => #372fd9
    [tfoot_bgcolor] => #F9F9F9
    [tfoot_fgcolor] => #372fd9
    [alt1_bgcolor] => #ffffff
    [alt1_fgcolor] => #000000
    [alt2_bgcolor] => #ffffff
    [alt2_fgcolor] => #000000
    [wysiwyg_bgcolor] => #ffffff
    [wysiwyg_fgcolor] => #000000
    [smallfont_fgcolor] => #000000
    [time_fgcolor] => #000000
    [navbar_fgcolor] => #000000
    [highlight_fgcolor] => #FF0033
    [fjsel_bgcolor] => #ffffff
    [fjsel_fgcolor] => #655de1
    [fjdpth0_bgcolor] => #f7f7f7
    [fjdpth0_fgcolor] => #000000
    [panel_bgcolor] => #ffffff
    [panel_fgcolor] => #000000
    [panelsurround_bgcolor] => #fafa86
    [panelsurround_fgcolor] => #000000
    [legend_fgcolor] => #372fd9
    [vbmenu_control_bgcolor] => #fafa86
    [vbmenu_control_fgcolor] => #655de1
    [vbmenu_popup_bgcolor] => #ffffff
    [vbmenu_popup_fgcolor] => #655de1
    [vbmenu_option_bgcolor] => #fafa86
    [vbmenu_option_fgcolor] => #655de1
    [vbmenu_hilite_bgcolor] => #ffffff
    [vbmenu_hilite_fgcolor] => #655de1
)


Then just select the style var(s) you want to use... (remember to remove [print_r ( $stylevar );] after getting the array that you will use as your guide!)

example....

Code:

##################################################  #########################
##  SET YOUR OWN COLOURS HERE
##################################################  #########################
 
                        ?>
                        <body bgcolor="<?=$stylevar['thead_bgcolor'];?>" text="<?=$stylevar['thead_fgcolor'];?>" link="<?=$stylevar['thead_fgcolor'];?>" alink="<?=$stylevar['tfoot_fgcolor'];?>" vlink="<?=$stylevar['thead_fgcolor'];?>">
                        <font face="verdana" size="1"><a href="member.php?u=<? echo "$postuserid"; ?>" target="blank">
                        <b><? echo "$name"; ?></b></a><br><? echo "$comment"; ?><br><br></font></body>
 
                        <?
                        }




Sonia

Lizard King 04-09-2005 01:24 AM

Thanks Sonia :) Finally I get this working :)


All times are GMT. The time now is 11:47 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.01074 seconds
  • Memory Usage 1,787KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete