Jump to content

Show announcements other than on index page


Sophia

Recommended Posts

Hi everybody :)

 

I have a silly problem: There is an announcements block on the index.php. I looked at the code, it says

 

{if $announcements}
<h2>{$LANG.latestannouncements}</h2>
<p>{$announcements.0.date} - <a href="{if $seofriendlyurls}announcements/{$announcements.0.id}/{$announcements.0.urlfriendlytitle}.html{else}announcements.php?id={$announcements.0.id}{/if}">{$announcements.0.title}</a><br />{$announcements.0.text|strip_tags|truncate:100:"..."}</p>
{/if}

 

I want to show the announcements in another page within the WHMCS system. I created the welcome.php and welcome.tpl, all went well and the html content I put in the tpl file shows up, no problem.

 

However, the announcements do NOT show up. I deleted the {if $announcements} and {/if} just to see what happens then, and it does say "Latest announcements", but the actual announcement does not show up except the dash.

 

On the index.php it does. Any ideas what I did wrong? :? Oh I'm using Whmcs v4.1.1

Link to comment
Share on other sites

Thanks again for the reply :) My whmcs system is situated in the folder "support" right under public_html/, so I figured I did not need to change anything. I did add a slash before the /support/etc just to make sure the path is right. I get no error messages, announcements just don't show up whereas they do show up on the portal page. Very very strange indeed... I'm sure I am doing something wrong :( But what?

 

I tried this code:

 

<?php
include("support/dbconnect.php");
include("support/includes/functions.php");
$query = "SELECT * FROM tblannouncements WHERE published='on' ORDER BY date DESC LIMIT 0,3"; 
$result = mysql_query($query);
while ($data = mysql_fetch_array($result)) {
$id = $data["id"];
$date = $data["date"];
$title = $data["title"];
$announcement = $data["announcement"];
$date = fromMySQLDate($date);
 echo("<p><font color=#cccccc>$date</font> - <b>$title</b><br>$announcement</p>");
}
?>

 

then I also changed it to

 

<?php
include("/support/dbconnect.php");
include("/support/includes/functions.php");
$query = "SELECT * FROM tblannouncements WHERE published='on' ORDER BY date DESC LIMIT 0,3"; 
$result = mysql_query($query);
while ($data = mysql_fetch_array($result)) {
$id = $data["id"];
$date = $data["date"];
$title = $data["title"];
$announcement = $data["announcement"];
$date = fromMySQLDate($date);
 echo("<p><font color=#cccccc>$date</font> - <b>$title</b><br>$announcement</p>");
}
?>

 

Oh, and I did not use any custom table prefixes or anything, installation was out of the box.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated