Results 1 to 4 of 4

Thread: rating_error template

  1. #1
    Join Date
    Jul 2007
    Posts
    41

    Default rating_error template

    hi. if this is the wrong forum for this post, mod, please feel free to move. I am trying to modify the rating_error.html file. I am having trouble displaying the <%$title%> tag to appear. code is as follows:

    Code:
    <%include file="header.html"
              title="Rate a link"
              meta_keywords=""      
    %>
    <meta http-equiv="refresh" content="4;URL=javascript: history.go(-1)">
        </td>
      </tr>
      <tr>
        <td>
    
        <!-- main content here -->
    
        <br />
        <b>Rate a Link</b>
    	<p>There was an error rating<b><%$title%></b></p>
         <p><%$error_msg%>.</p>
    
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
    
        <!-- end of main content -->
    
        </td>
      </tr>
      <tr>
        <td>
    
    <%include file="footer.html"%>
    Here is the php:

    Code:
    <?php
    function ProcessRating() {
    
        // vars global configuration
        global $theme_path, $top_rated_limit;
    
        // vars url & form
        global $id, $rating;
    
        // vars messages
        global $msg, $title;
    
        // vars template
        global $error_msg;
    
        $links_obj = new clsLink;
        $links_obj->query            = "select * from idx_link where link_id = '$id'";
        $links_obj->table_name       = "idx_link";
        $links_obj->votes_table_name = "idx_votes";
        $links_obj->top_rated_limit  = $top_rated_limit;
        $rating_result               = $links_obj->RateLink($id, $rating);
    
        if ($rating < 1 || $rating > 5) {
          $rating_result = 2; // error
        }
    
    
        // success
        if ($rating_result == 0) {
          $title = $links_obj->GetLinkTitle($id);
          DisplayTemplate($theme_path . "rating_ok.html", "\$title");
        }
        
        // user already rated
        elseif ($rating_result == 1) {
          $error_msg = $msg["10171"];
          DisplayTemplate($theme_path . "rating_error.html", "\$error_msg");
        }
    
        // rated fail
        else {
    	  $error_msg = $msg["10172"];
    	  $title = $links_obj->GetLinkTitle($id);
          DisplayTemplate($theme_path . "rating_error.html", "\$error_msg", "\$title");
        }
      }
    
    
      /*===================================================
        main
      ===================================================*/
    
      include "application.php";
    
      RunPreFilter(__FILE__);
    
      $query     = "select suspended from idx_link where link_id = '$id'";
      $result    = $dbConn->Execute($query);
      $suspended = $result->Fields("suspended");
    
      if ($suspended) {
        DisplayTemplate($theme_path . "suspended.html");
        RunPostFilter(__FILE__);
      }
    
      ProcessRating();
    
      RunPostFilter(__FILE__);?>
    I have tried to change the position of the $title var in the php, but no luck. I can see that the variable
    Code:
    $rating_result = $links_obj->RateLink($id, $rating)
    is taking on obviously it is something i haven't set correctly. any help greatly appreciated. Many thanks.

    Version: 5.3

  2. #2
    Join Date
    Jul 2007
    Posts
    41

    Default

    {{BUMP}} Thinks all peeps have gone to coder heaven :-)

  3. #3
    Join Date
    Nov 2004
    Posts
    1,822

    Default

    it wont work if it fails IF the user has already rated, change the line to this :

    DisplayTemplate($theme_path . "rating_error.html", "\$error_msg", "\$title");

    that asses the title variable to the template.
    Main IndexU sites : | Campsite Directory | Tourist Guide | Places2B | AfterDirectory <-- Half price submission using coupon DP50 (from just $11 premium, and $10 basic permanent )

  4. #4
    Join Date
    Jul 2007
    Posts
    41

    Default

    thanks inspireme. but i have that command already in php file. i am trying print message in someone just presses rate it button without rating site.

    Code:
    // rated fail
        else {
    	  $error_msg = $msg["10172"];
    	  $title = $links_obj->GetLinkTitle($id);
          DisplayTemplate($theme_path . "rating_error.html", "\$error_msg", "\$title");
        }
      }
    or am i missing something here? i am trying print message in someone just presses rate it button without rating site. another thing, where do the message numbers come from. they are not in lang file. are they generated on the fly. cheers.

Similar Threads

  1. 3 New Template Available + Template Price reduced!!
    By sikumbang in forum Templates
    Replies: 9
    Last Post: 07-23-2007, 09:27 AM
  2. The Template Tag
    By ime in forum Templates
    Replies: 10
    Last Post: 05-01-2006, 11:31 AM
  3. php in template
    By snaip in forum Templates
    Replies: 1
    Last Post: 10-01-2004, 04:31 AM
  4. Replies: 3
    Last Post: 04-24-2003, 04:31 PM
  5. Template
    By csengine in forum Templates
    Replies: 3
    Last Post: 04-12-2003, 07:01 PM

Posting Permissions

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