Jump to content

get Latest feed from site


lims

Recommended Posts

i have following code using php its work but i dont know how to implementation into whmcs

display in client area or whmcs footer (link rss code only for example )

<?php
$rss = simplexml_load_file('http://feeds.bbci.co.uk/news/england/rss.xml');
$feed = 0;
foreach ($rss->channel->item as $item) {
	if($feed<4){
   	echo '<div><a href="'. $item->link .'" title="'.$item->title.'">' . $item->title . "</a></div>";
	}
	$feed++;
}
?>

anyone please help hook or some thing

mention @brian! 😁

Link to comment
Share on other sites

Easily achievable using the ClientAreaPage hook to pass the feed through the the footer as a smarty variable.

Create a hook file and add the following:

<?php
 
function bbc_feed($vars) {
 
    $rss = simplexml_load_file('http://feeds.bbci.co.uk/news/england/rss.xml');
 
    return [
        'bbcfeed' => $rss->channel->item
    ];
 
}
 
add_hook('ClientAreaPage', 1, 'bbc_feed');

Then add the following to your footer.tpl file (in whatever template you use):

{foreach $bbcfeed as $item}
            {if $item@index eq 4}
                {break}
            {/if}
            <div><a href="{$item->link}" title="{$item->title}">{$item->title}</a></div>
        {/foreach}

Where you put the code, or what type of style you add to it is entirely up to you.

Link to comment
Share on other sites

  • 7 months later...
On 8/21/2022 at 5:05 PM, leemahoney3 said:

Easily achievable using the ClientAreaPage hook to pass the feed through the the footer as a smarty variable.

Create a hook file and add the following:

<?php
 
function bbc_feed($vars) {
 
    $rss = simplexml_load_file('http://feeds.bbci.co.uk/news/england/rss.xml');
 
    return [
        'bbcfeed' => $rss->channel->item
    ];
 
}
 
add_hook('ClientAreaPage', 1, 'bbc_feed');

Then add the following to your footer.tpl file (in whatever template you use):

{foreach $bbcfeed as $item}
            {if $item@index eq 4}
                {break}
            {/if}
            <div><a href="{$item->link}" title="{$item->title}">{$item->title}</a></div>
        {/foreach}

Where you put the code, or what type of style you add to it is entirely up to you.

Is there a way to display it just on the homepage (custom page) with image and date when it's posted? To be specific i would like to display them from my WordPress blog if this is possible.

Edited by Businezz
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.

×
×
  • 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