Jump to content

Create pages from your announcements for whmcs 6x


ryans

Recommended Posts

This script will let you make your own pages out of your announcements. Here is how to do it.

 

create articles.php and put in this code. Upload it to your root whmcs directory

 

<?php

define("CLIENTAREA", true);
//define("FORCESSL", true); // Uncomment to force the page to use https://

require("init.php");

$ca = new WHMCS_ClientArea();

$ca->setPageTitle("Articles");

$ca->addToBreadCrumb('index.php', $whmcs->get_lang('globalsystemname'));
$ca->addToBreadCrumb('mypage.php', 'Article');

$ca->initPage();

//$ca->requireLogin(); // Uncomment this line to require a login to access this page

# To assign variables to the template system use the following syntax.
# These can then be referenced using {$variablename} in the template.

$ca->assign('variablename', $value);

# Check login status
if ($ca->isLoggedIn()) {

 # User is logged in - put any code you like here

 # Here's an example to get the currently logged in clients first name

 $result = mysql_query("SELECT firstname FROM tblclients WHERE id=" . $ca->getUserID());
 $data = mysql_fetch_array($result);
 $clientname = $data[0];

 $ca->assign('clientname', $clientname);

} else {

 # User is not logged in

}


$id = intval($_GET['id']);
$query = "SELECT * FROM `tblannouncements` WHERE `id` = {$id} ";
$result = mysql_query($query);

    while ($data = mysql_fetch_array($result)) {

        $id = $_GET['id'];

        $date = $data["date"];

        $title = $data["title"];

        $announcement = $data["announcement"];

        $date = fromMySQLDate($date);

}
$ca->assign('announcement', $announcement);

# Define the template filename to be used without the .tpl extension

$ca->setTemplate('article');

$ca->output();

 

 

Then create an articles.tpl file and upload that to your theme directory. It's very short code.

 

{$announcement}
<br><br><center>Article Mods by <a href=http://norcalhelpdesk.com target=new>NCHD</a></center>

 

Access your articles by going to your site.com/articles.php?id=1 or whatever your id # is for your article.

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