Open best4uall opened 7 years ago
The template file is loaded client side, PHP is server side. So I don't see the use case. Can you give more details?
As per joomla structure we create a view file default.php, we need to create all the HTML structure in this PHP file. You can see following code. i want to load all HTML structure in the same PHP file. is it possible.
`
$document = & JFactory::getDocument();
$document->addStyleSheet(JURI::base() . 'modules/mod_xp_twitter/tmpl/css/jquery.socialfeed.css" media="screen');
$document->addScript(JURI::base() . 'modules/mod_xp_twitter/tmpl/js/jquery.socialfeed.js');
//$document->addScript(JURI::base() . 'modules/mod_xp_twitter/tmpl/js/jquery.socialfeed.js');
//echo $xpertpress;
?>
<script type="text/javascript">
jQuery('.social-feed-container').socialfeed({
// TWITTER
twitter: {
accounts: ['@spacex'], //Array: Specify a list of accounts from which to pull tweets
limit: 2, //Integer: max number of tweets to load
consumer_key: 'JmYgwELSEFdVVMskFQ1JD7pHE', //String: consumer key. make sure to have your app read-only
consumer_secret: 'KoeY413VdtE2eHaa6XFVCqEkOkVuSKWxRSPIXHDJPFArHpMkOe' //String: consumer secret key. make sure to have your app read-only
},
// GENERAL SETTINGS
length: 400, //Integer: For posts with text longer than this length, show an ellipsis.
show_media: true, //Boolean: if false, doesn't display any post images
media_min_width: 300, //Integer: Only get posts with images larger than this value
update_period: 5000, //Integer: Number of seconds before social-feed will attempt to load new posts.
template: "bower_components/social-feed/template.html", //String: Filename used to get the post template.
template_html: //String: HTML used for each post. This overrides the 'template' filename option
'<article class="twitter-post"> \
<h4>{{=it.author_name}}</h4><p>{{=it.text}} \
<a href="{{=it.link}}" target="_blank">read more</a> \
</p> \
</article>',
date_format: "ll", //String: Display format of the date attribute (see http://momentjs.com/docs/#/displaying/format/)
date_locale: "en", //String: The locale of the date (see: http://momentjs.com/docs/#/i18n/changing-locale/)
moderation: function (content) { //Function: if returns false, template will have class hidden
return (content.text) ? content.text.indexOf('fuck') == -1 : true;
},
callback: function () { //Function: This is a callback function which is evoked when all the posts are collected and displayed
console.log("All posts collected!");
}
});
</script>
<div class="social-feed-container"></div>`
is there any solution?
Can't you use template_html
instead of template
? In your example you use both parameters, but template
overwrites template_html
. Removing the line "template: "bower_comp...." will do.
i think istructions of social-feed script are really confusing. If we take alook to the all parameters (the bottomo code example) all template options are used. Alos the script in the demo is the Old one. Who can manage to fix it?
Can we pull template code into PHP File, We are trying to create Joomla Module. Can you please help me.