SitePoint Sponsor

User Tag List

Results 1 to 14 of 14
  1. #1
    SitePoint Enthusiast meRn's Avatar
    Join Date
    Dec 2006
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Message not displaying?

    Hi, after a member posted a comment, the below code is supposed to display "Your comment has been successfully posted etc" but it doesn't for some reason. Do you have any idea where should I look for the error, I compared this .tpl file with the original one from the seller and there's nothing that's not the same.

    PHP Code:
    {if $smarty.session.UID ne "" and $isvideocommented ne ""}
                                    <
    DIV ID=divComments>
                                            <
    FORM name="Add_comment" method="post" action="{$baseurl}/view_video.php?viewkey={$smarty.request.viewkey}&page={$smarty.request.page}&viewtype={$smarty.request.viewtype}&category={$smarty.request.category}">
                                            <
    DIV id=div_main_comment style="PADDING-left: 10px">

                                            <
    textarea name=addcomment ID=txtComments rows=5 cols=30></textarea>
                                            <
    br>
                                                    <
    input type="button" name="commentpost" value="Post Comment" onClick=fxSendComments('divComments','txtComments',{$smarty.session.UID},{$VID})>
                                            </
    DIV>
                                            </
    FORM>
                                    </
    DIV >
                                    <
    DIV ID=divComResult1 style='display:none'>
                                            <
    B><FONT COLOR=#339900>Your Comments has posted successfully.</FONT></B>
                                    
    </DIV>
                                    <
    DIV ID=divComResult2 style='display:none'>
                                            <
    B><FONT COLOR=#FF0033>Your already posted you comments.</FONT></B>
                                    
    </DIV>
                            {/if} 

  2. #2
    SitePoint Enthusiast meRn's Avatar
    Join Date
    Dec 2006
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I replaced the file with the original file and it's still not displaying, can anyone help me please?

  3. #3
    An average geek earl-grey's Avatar
    Join Date
    Mar 2005
    Location
    Ukraine
    Posts
    1,403
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Add an else statement:
    Code:
    {if $smarty.session.UID ne "" and $isvideocommented ne ""}
    .....
    {else}
    Session id: {$smarty.session.UID}<br />
    Is video commented: {$isvideocommented}<br />
    {/if}
    and tell us the output you get

  4. #4
    SitePoint Enthusiast meRn's Avatar
    Join Date
    Dec 2006
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If statement is to check if the visitor is a guest. If he/she is a guest, that comment will ask him to log in.

  5. #5
    SitePoint Enthusiast meRn's Avatar
    Join Date
    Dec 2006
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I added the code you gave and received a fatal error.

  6. #6
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up your problem

    I REALLY dont like that way of coding (prefer REAL php), but this is your problem:

    Code:
    style='display:none'
    You want to have a code like (in real PHP sorry):
    PHP Code:
    style='display:<?
    if(!isset($isvideocommented)){
    echo 
    "none";
    }else{
    echo 
    "block";
    }
    ?>'
    But, again, never use extentions (including smarty) that change PHP syntax. You will need legit PHP.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  7. #7
    SitePoint Enthusiast meRn's Avatar
    Join Date
    Dec 2006
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Doesn't work, like I said, I replaced the whole .tpl code with the one from the seller and it still doesn't work, it's supposed to work, can you explain to me how the div tags work? I think I can explore the error and fix it.

  8. #8
    SitePoint Enthusiast meRn's Avatar
    Join Date
    Dec 2006
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by arkinstall View Post
    I REALLY dont like that way of coding (prefer REAL php), but this is your problem:

    Code:
    style='display:none'
    You want to have a code like (in real PHP sorry):
    PHP Code:
    style='display:<?
    if(!isset($isvideocommented)){
    echo 
    "none";
    }else{
    echo 
    "block";
    }
    ?>'
    But, again, never use extentions (including smarty) that change PHP syntax. You will need legit PHP.
    I'm sorry but I don't know PHP, this is from the script itself, so do I just replace that portion with the code you just gave?

    Thanks a lot for helping me out.

  9. #9
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    yep. What is this code used for? Unless it's a kind of PHPBB application, i would suggest learning PHP.

    My favorite tutorial site is w3schools. They taught me everything i needed to know for amateur PHPing, and the rest you learn from here!
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  10. #10
    SitePoint Enthusiast meRn's Avatar
    Join Date
    Dec 2006
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's not phpBB, it's a video sharing site like youtube. This is the comment feature.

    BTW, I replaced the code, but it doesn't seem to work, I hope you know how smarty template works.

  11. #11
    An average geek earl-grey's Avatar
    Join Date
    Mar 2005
    Location
    Ukraine
    Posts
    1,403
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by meRn View Post
    If statement is to check if the visitor is a guest. If he/she is a guest, that comment will ask him to log in.
    Yes, but the problem is there, right?
    Is an empty output all you get?

  12. #12
    SitePoint Enthusiast meRn's Avatar
    Join Date
    Dec 2006
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, not that, the problem is, it's not displaying the "Your comment was successfully posted" message when someone successfully posted.

  13. #13
    An average geek earl-grey's Avatar
    Join Date
    Mar 2005
    Location
    Ukraine
    Posts
    1,403
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Probably this is what you're looking for:
    Code:
    {if $smarty.session.UID ne ""} 
                                    <DIV ID=divComments> 
                                            <FORM name="Add_comment" method="post" action="{$baseurl}/view_video.php?viewkey={$smarty.request.viewkey}&page={$smarty.request.page}&viewtype={$smarty.request.viewtype}&category={$smarty.request.category}"> 
                                            <DIV id=div_main_comment style="PADDING-left: 10px"> 
    
                                            <textarea name=addcomment ID=txtComments rows=5 cols=30></textarea> 
                                            <br> 
                                                    <input type="button" name="commentpost" value="Post Comment" onClick=fxSendComments('divComments','txtComments',{$smarty.session.UID},{$VID})> 
                                            </DIV> 
                                            </FORM> 
                                    </DIV > 
    {if $isvideocommented ne ""}
                                    <DIV ID=divComResult1 style='display:none'> 
                                            <B><FONT COLOR=#339900>Your Comments has posted successfully.</FONT></B> 
                                    </DIV> 
    {else}
                                    <DIV ID=divComResult2 style='display:none'> 
                                            <B><FONT COLOR=#FF0033>Your already posted you comments.</FONT></B> 
                                    </DIV> 
    {/if}
                            {/if}

  14. #14
    SitePoint Enthusiast meRn's Avatar
    Join Date
    Dec 2006
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't think you understand, the code's supposed to work fine, the problem is supposed to be besides the code. As I've mentioned, I replaced the .tpl file (this file) with the working version but it still isn't working. Thanks for the effort anyway.

    Let me know if you/anyone know something else, like maybe it's the function.php etc


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •