13. Solid – homepage portfolio

Don't forget - it was written in 2014

comments: 0
This is short post about steps I did to get this worked, but there is better solution that are solving other parts of site. But maybe sometime in future I will need this:
I created new news category ($id = 2).
Now I have working parts of code and I only need to use better (not so custom) solution (? idea - news and other news for separate blog and portfolio news item)

1. set layout
<div id="portfoliowrap">

2. add javascript for portfolio (from footer of index.html page, it's the same on all pages)
e107::js('theme', 			"assets/js/portfolio.js");

3. create template in theme plugin folder: (template/themesolid_template.php)
$THEMESOLID_TEMPLATE['recentworks']['start'] = '        
<div class="portfolio-centered">
  <div class="recentitems portfolio">';
$THEMESOLID_TEMPLATE['recentworks']['item'] = ' 
{SETIMAGE: w=600}
<div class="portfolio-item graphic-design">
 <div class="he-wrap tpl6">
  <div class="he-view">
		 <div class="bg a0" data-animate="fadeIn">
         <h3 class="a1" data-animate="fadeInDown">{newstitle}</h3>
          <a data-rel="prettyPhoto" href="'.e_THEME_ABS.'solid/assets/img/portfolio/portfolio_09.jpg" class="dmbutton a2" data-animate="fadeInUp"><i class="fa fa-search"></i></a>
          <a href="'.e_HTTP.'news.php?extend.{NEWSID}" class="dmbutton a2" data-animate="fadeInUp"><i class="fa fa-link"></i></a>
$THEMESOLID_TEMPLATE['recentworks']['end'] = ' </div> </div> ';

4. create new menu in theme plugin folder (recent_work_menu.php)
if (!defined('e107_INIT')) { exit; }

$nobody_regexp = "'(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)'";

$caption = "LATEST WORKS";
$category = 2;

$query = "
SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon, nc.category_meta_keywords,
FROM #news AS n
LEFT JOIN #user AS u ON n.news_author = u.user_id
LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
WHERE n.news_category=".$category."
ORDER BY n.news_datestamp DESC";
$newsList = array();
$ix = new news;
		$newsList = $sql->db_getList();
$template = e107::getTemplate('themesolid');
e107::getEvent()->trigger('news_list_parse', $newsList); 

// print_a($template);
		$text .= $tp->parseTemplate($template['recentworks']['start'], true);		
	foreach($newsList as $row)
		$text .= $ix->render_newsitem($row, 'return', '', $template['recentworks']['item'], true);

		$text .= $tp->parseTemplate($template['recentworks']['end'], true);				

$ns -> tablerender($caption, $text, "recentworks");