Fork me on GitHub

display greeting  Bottom

  • Hello,

    I have hack function displaygreeting to have different message or it doesn't work
    I have i my message some javascript
    here is code of my function and my javascript files

    Code

    function smarty_function_displaygreeting($params, &$smarty)
    {
        extract($params);
        unset($params);

        // set some defaults
        if (isset($class)) {
            $class = ' class="'.$class.'"';
        } else {
            $class = '';
        }
    // Get the db connection
        $dbconn =& pnDBGetConn(true);
        $pntable =& pnDBGetTables();

        // Turn on message display if not explicitly set or set true, or Display All is set
        $displayMsgs = !isset($displayMsgs) || $displayMsgs || isset($displayAllMsgs) ? true : false;
        $displayAllMsgs = isset($displayAllMsgs) && $displayAllMsgs ? true : false;
        $multiline = isset($multiline) && $multiline ? true : false;
        $unameclickable = isset($unameclickable) && $unameclickable ? true : false;

    if (pnUserLoggedIn()) {
            $username = pnUserGetVar('uname');
            $loggedin = _HELLO." ".$username;
            // connexion
    $tt = time();
    $mois = date("m",$tt);
    $jour = date("d",$tt);

                // Gather Users unread messages
               $query = "SELECT fete
                        FROM $pntable[fetes]
                        WHERE mois=$mois And jour=$jour"
    ;

                $result =& $dbconn->Execute($query);
                if ($dbconn->ErrorNo() == 0) {
                    if (!$result->EOF) {
                        $result->Close();
                        $userfete = $result->PO_RecordCount();
                        $greting = print(" ".$row[0]."<br>");
                    }
                }
           
         
        $greeting = $loggedin."".$messages."\n";
        return $greeting;
    }
        if (pnUserLoggedIn()) {
            $greeting = '<span' . $class . '>';
            if ($unameclickable) {
                $profileModule = pnConfigGetVar('profilemodule', '');
                if (!empty($profileModule) && pnModAvailable($profileModule)) {
                    $greeting .= '<span'.$class.'>'._THEME_WISH."</span>\n";
                    $greeting .= '<!--[modulejavascript script=periode.js ]-->';
                    $greeting .= '<span'.$class.'>'._THEME_TO."</span>\n";
                    $greeting .= '<span'.$class.'>'._THEME_WELCOMEUSER."</span>\n";
                     $greeting .= '<span'.$class.'>'._THEME_TODAY."</span>\n";
                    $greeting .='<!--[modulejavascript script=date.js onload="jourcourant()" ]-->';
                     $greeting .= '<span'.$class.'>'._THEME_TIME."</span>\n";
                     $greeting .='<!--[modulejavascript script=time.js onload="loadclock()"]-->';
                     $greeting .= '<span'.$class.'>'._THEME_HOLIDAYS."</span>\n";
                     $pntables = pnDBGetTables();
    $onecolumns = $pntables['fetes_one_column'];
    $columns = DBUtil::expandColumnsWithJoinInfo($onecolumns, $joinInfo);

    $where = 'mois=$mois And jour=$jour]';

    $result = DBUtil::selectExpandedObjectArray('table_one', $joinInfo, $where);
                     $greeting .= print(" ".$row[0]."<br>");
                     return $greeting;
                    $greeting .= pnML('_THEME_WISH', array('username' => '<a href="' . pnModURL($profileModule) . '">' . pnUserGetVar('uname') . '</a>'), true);
                } else {
                    $greeting .= pnML('_THEME_WELCOMEUSER', array('username' => pnUserGetVar('uname')));
                }
            } else {
                $greeting .= pnML('_THEME_WELCOMEUSER', array('username' => pnUserGetVar('uname')));
            }

            $msgmodule = pnConfigGetVar('messagemodule', '');
            if (pnModAvailable($msgmodule) && ($displayMsgs || $displayAllMsgs)) {
                $messages = pnModAPIFunc($msgmodule, 'user', 'getmessagecount');
                $inboxurl = DataUtil::formatForDisplay(pnModURL($msgmodule, 'user', 'inbox'));
                if ($multiline) {
                    $greeting .= "<br />\n";
                } else {
                    $greeting .= '&nbsp;';
                }
                if ($displayAllMsgs) {
                    if ($messages['totalin'] > 0) {
                        $greeting .= pnML('_THEME_YOUHAVEXPRIVATEMESSAGES', array('x' => $messages['totalin'], 'u' => $messages['unread'], 'url' => $inboxurl), true);
                    } else {
                        $greeting .= pnML('_THEME_YOUHAVENOPRIVATEMESSAGES', array('url' => $inboxurl), true);
                    }
                } else {
                    if ($messages['unread'] > 0) {
                        $greeting .= pnML('_THEME_YOUHAVEXNEWPRIVATEMESSAGES', array('x' => $messages['unread'], 'url' => $inboxurl), true);
                    } else {
                        $greeting .= pnML('_THEME_YOUHAVENONEWPRIVATEMESSAGES', array('url' => $inboxurl), true);
                    }
                }
            }
            $greeting .="</span>\n";
        } else {  // If not logged in, show login link, ask them to register
           $greeting .= '<span'.$class.'>'._THEME_WISH."</span>\n";
                    $greeting .= '<!--[modulejavascript script=periode.js ]-->';
                    $greeting .= '<span'.$class.'>'._THEME_TO."</span>\n";
                    $greeting .= '<span'.$class.'>'._THEME_WELCOMEGUEST."</span>\n";
                     $greeting .= '<span'.$class.'>'._THEME_TODAY."</span>\n";
                    $greeting .='<!--[modulejavascript script=date.js onload="jourcourant()" ]-->';
                     $greeting .= '<span'.$class.'>'._THEME_TIME."</span>\n";
                     $greeting .='<!--[modulejavascript script=time.js onload="loadclock()"]-->';
                     $greeting .= '<span'.$class.'>'._THEME_HOLIDAYS."</span>\n";
        } // end login and private messages

        return $greeting;
    }


    date

    Code

    if (self != top) top.location.replace(self.location);
    function show_props(obj,obj_name){
    var result="";
    for(var i in obj) result+= obj_name+"."+i+" = "+obj[i]+"\n";
    return result;
     }
    function Semaine(){
    this[0] = "dimanche";
    this[1] = "lundi";
    this[2] = "mardi";
    this[3] = "mercredi";
    this[4] = "jeudi";
    this[5] = "vendredi";
    this[6] = "samedi";
     }
    function Mois(){
    this[0] = "Janvier";
    this[1] = "F&eacute;vrier";
    this[2] = "Mars";
    this[3] = "Avril";
    this[4] = "Mai";
    this[5] = "Juin";
    this[6] = "Juillet";
    this[7] = "Aout";
    this[8] = "Septembre";
    this[9] = "Octobre";
    this[10] = "Novembre";
    this[11] = "D&eacute;cembre";
    }
    function jourcourant(){
    var semaine = new Semaine();
    var mois = new Mois();
    var myDate = new date();
    var nav = navigator.appName.charAt(0);
    if (nav=="N") {
    document.writeln(semaine[myDate.getDay()]+" "+myDate.getdate()+" "+mois[myDate.getMonth()]+" "+(1900+myDate.getYear()));
    } else {
    document.writeln(semaine[myDate.getDay()]+" "+myDate.getdate()+" "+mois[myDate.getMonth()]+" "+(myDate.getYear()));
    }
     }

    function efface(form,name)
    {
    eval ( that = document.forms[0] [name]);
    if ( name == 'email' && that.value == 'Votre e-mail' )
    {
    that.value = '';
    }
    else return false;
    }


    time

    Code

    // JavaScript Document
      <!--
    function show2(){
    var Digital=new date()
    var hours=Digital.getHours()
    var minutes=Digital.getMinutes()
    var seconds=Digital.getSeconds()
    if (hours<10)
    hours="0"+hours
    if (minutes<=9)
    minutes="0"+minutes
    if (seconds<=9)
    seconds="0"+seconds
    var ctime="<b>"+hours+" H "+minutes+" M "+seconds+" S</b>"
    if (!document.all)
    document.write(ctime)
    else
    tick2.innerHTML=ctime
    }
    function loadclock(){
    if (document.all)

    setInterval("show2()",1000)
    }
    if (!document.all)
    show2()
    //-->


    and periode

    Code

    // JavaScript Document
    <!-- Begin
    document.write("<b>")
    day = new date()
    hr = day.getHours()

    if  ((hr == 23) || (hr == 0) || (hr == 1) || (hr == 2) || (hr == 3) || (hr == 4))
      document.write("Bonne nuit !, ")

     if  ((hr == 5) || (hr == 6))
      document.write("Bonne matinée, le café est pret, ")

    if ((hr == 7) || (hr == 8) || (hr == 9) || (hr == 10) || (hr == 11))
      document.write("Bonne journée,")

    if ((hr == 12) || (hr == 13) || (hr == 14) || (hr == 15) || (hr == 16))
      document.write("Bon après-midi,")

    if ((hr == 17) || (hr == 18) || (hr == 19) || (hr == 20) || (hr == 21) || (hr == 22))
      document.write("Bonne soirée,")
     document.write("&nbsp;")
    // End -->


    before my message works but when i try to put in zikula not icon_smile
  • i see that you're trying to use this code inside the plugin output:

    Code

    <!--[modulejavascript script=periode.js ]-->

    But the problem is that the plugin output is not parsed by Smarty, and you should call your plugin directly or use PageUtil to add your javascript file to the header...

    But i see another param: onload, so, a direct include and call may be the better option for you. Greetings

    --
    - Mateo T. -
    Mis principios... son mis fines
  • Thanks for reponse i will do it with direct include and callbtw is it in zikula same code to direct include as in PN 0.7?

    Sorry for my 2 question icon_smile

    I have this code in my theme template

    Code

    <div id="topnav">
                <div id="rss-big"><a href="backend.php" title="Abonnez-vous à ce site avec RSS" rel="nofollow"  class="rss-big"></a></div>
           
        </div>

    and my css for rss
    #rss-big{
        position:absolute;
       display:block;
        background:url(../../images/rssbig.gif);
        width:111px;
      height:67px;
        top:100px;
        left:40px;
      }


    Image of RSS is showing but the link for image doesn't works if i erase this display block in CSS image can't be seen
  • Code

    background:url(../../images/rssbig.gif);


    I didn't check what I'm saying, but isn't there a bad path to the image there?

    --
    David
    http://zikula.tv
  • non i can see image but image isn't a link to backend.php

    It is just a image without a link

    because if i put this

    Code

    background:url(../images/rssbig.gif)


    there is no image at all but text for link is seen
  • Anyway, why did you put the image as a background in CSS? Why didn't you just use a normal link? Did you try this already? (I guess you'd need to modify the path -- path now in relation to template, rather than in relation to stylesheet)

    Code

    <a href="backend.php" title="Abonnez-vous à ce site avec RSS" rel="nofollow"  class="rss-big"><img src="../../images/rssbig.gif" alt="Abonnez-vous à ce site avec RSS"></a>


    Also, re-write that 'rss-big' style? Again, I didn't try this out before posting, but I wondered why you put all the positioning in 'rss-big'? Instead, maybe you could wrap the A and IMG tags inside a DIV and then positioning the DIV like this:

    CSS:

    Code

    #rss-link /* DIV */ {
        position:absolute;
       display:block;
        top:100px;
        left:40px;
      }


    HTML:

    Code

    <div id="rss-link"><a href="backend.php" title="Abonnez-vous à ce site avec RSS" rel="nofollow"><img src="../../images/rssbig.gif" alt="Abonnez-vous à ce site avec RSS"></a></div>


    (Modify image path.)

    Just some ideas... HTH icon_smile

    --
    David
    http://zikula.tv
  • And delete the above line in the style (not necessary in my suggested snippet):

    Code

    display:block;


    --
    David
    http://zikula.tv
  • Another after-thought:

    Why the absolute positioning, and not relative? (Just a question... Might be what you need in your case... IIRC, could be browser compatibility issues involved...)

    --
    David
    http://zikula.tv
  • hanks for help i found where was a probleme icon_smile

    I have forget to put in my CSS this :

    Code

    #rss-big a {
      display:block;
      width:110px;
      height:64px;
    }


    And it works

    Now i have to do a function that include my welcome text
  • Quote

    PageUtil
    ???

    can you elaborate on the basics of this or post a link to read more please?

    --
    Paul
    ____________________________________________________
    "...Humor, ITs just a state of mind"
    TakeIT2.CoM :: Open Destination
    ...my site is a perfect example of why doctors do not operate on them self :)
  • 0 users

This list is based on users active over the last 60 minutes.