I want to concatenate of multiple strings with condition
I am doing a loadmore in ajax and php and i want to dynamic the response, so i have tried below code
$newList .= '<ul>';
$newList .= '<li>';
$newList .= '<i class="fa fa-calendar"></i>';
$newList .= $this->Common_model->startend_date_format($getEvent['event_stat'], $getEvent['event_end']);
$newList .= '</li>';
$newList .= '<li>';
$newList .= '<i class="fa fa-map-marked"></i>';
if ($city != "") {
$newList .= '<a href=' . base_url() . 'city/' . $this->Common_model->makeSeoUrl($city) . '>' . ucfirst($city) . '</a>, ' ;
}
if ($state != "") {
$newList .= '<a href="' . base_url() . 'state/' . $this->Common_model->makeSeoUrl($state) . '>' . ucfirst($state) . '</a>,  ';
}
if ($get_country_name != "") {
$newList .= '<a href=' . base_url() . 'country/' . $this->Common_model->makeSeoUrl($get_country_name) . '/' . base64_encode($get_country_id) . '>' . ucfirst($get_country_name) . '</a>';
}
$newList .= '</li>';
$newList .= '<li>';
$newList .= '<i class="fa fa-tags"></i>';
$newList .= '<a href=' . base_url() . 'categories' . '#' . $cat_name_event . '>' . $cat_name_event . '</a>';
$newList .= '</li>';
$newList .= '</ul>';
and it is showing something like
but the actual result should be like
Related
I am trying to build a simple calendar using Carbon in Laravel 9. Also, I need to show some content from the database on specific dates. The calendar is well made without the other contents but with content, some dates which don't have external data are duplicated.
The controller code
$date = empty($date) ? Carbon::now() : Carbon::createFromDate($date);
$startOfCalendar = $date->copy()->firstOfMonth()->startOfWeek(Carbon::SUNDAY);
$endOfCalendar = $date->copy()->lastOfMonth()->endOfWeek(Carbon::SATURDAY);
$html = '<div class="calendar">';
$html .= '<div class="month-year">';
$html .= '<span class="month">' . $date->format('M') . '</span>';
$html .= '<span class="year">' . $date->format('Y') . '</span>';
$html .= '</div>';
$html .= '<div class="days">';
$dayLabels = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
foreach ($dayLabels as $dayLabel)
{
$html .= '<span class="day-label">' . $dayLabel . '</span>';
}
$get_events = CalendarEvents::where("event_date",">=",date("Y-m-d", strtotime($startOfCalendar)))->get();
while($startOfCalendar <= $endOfCalendar)
{
$extraClass = $startOfCalendar->format('m') != $date->format('m') ? 'dull' : '';
$extraClass .= $startOfCalendar->isToday() ? ' today' : '';
foreach ($get_events as $events) {
if($events->event_date == date('Y-m-d',strtotime($startOfCalendar))) {
$html .= '<span class="day flip' . $extraClass . '"><span class="content">' . $startOfCalendar->format('j').'|'.$events->event_name. '</span></span>';
}
else {
$html .= '<span class="day' . $extraClass . '"><span class="content">' . $startOfCalendar->format('j') . '</span></span>';
break;
}
}
$startOfCalendar->addDay();
}
$html .= '</div></div>';
Here the events' dates are printed once but dates without the events are printed multiple times. How can I correct this? Thanks in advance
your loop seems a bit off. Assuming you have multiple events on some days and no events on others, you probably want something like the following.
$date = empty($date) ?Carbon::now() : Carbon::createFromDate($date);
$startOfCalendar = $date->copy()->firstOfMonth()->startOfWeek(Carbon::SUNDAY);
$endOfCalendar = $date->copy()->lastOfMonth()->endOfWeek(Carbon::SATURDAY);
$html = '<div class="calendar">';
$html .= '<div class="month-year">';
$html .= '<span class="month">' . $date->format('M') . '</span>';
$html .= '<span class="year">' . $date->format('Y') . '</span>';
$html .= '</div>';
$html .= '<div class="days">';
$dayLabels = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
foreach ($dayLabels as $dayLabel)
{
$html .= '<span class="day-label">' . $dayLabel . '</span>';
}
$get_events = CalendarEvents::where("event_date", ">=", date("Y-m-d", strtotime($startOfCalendar)))->get();
while ($startOfCalendar <= $endOfCalendar)
{
$extraClass = $startOfCalendar->format('m') != $date->format('m') ? 'dull' : '';
$extraClass .= $startOfCalendar->isToday() ? ' today' : '';
$startOfCalendarFormated = $startOfCalendar->format('j');
$startOfCalendarSqlFormat = $startOfCalendar->format('Y-m-d');
$html .= '<span class="day flip' . $extraClass . '"><span class="content">';
$filled = false;
foreach ($get_events as $events) {
if ($events->event_date == $startOfCalendarSqlFormat) {
$html .= $startOfCalendarFormated . '|' . $events->event_name . "<br>";
$filled = true;
}
}
if(!$filled){
$html .= "No events | {$startOfCalendarFormated}";
}
$html .= '</span></span>';
$startOfCalendar->addDay();
}
$html .= '</div></div>';
I'm making assumptions on how you want your HTML formatted, but hopefully you get the picture.
$date = empty($date) ?Carbon::now() : Carbon::createFromDate($date);
$startOfCalendar = $date->copy()->firstOfMonth()->startOfWeek(Carbon::SUNDAY);
$endOfCalendar = $date->copy()->lastOfMonth()->endOfWeek(Carbon::SATURDAY);
$html = '<div class="calendar">';
$html .= '<div class="month-year">';
$html .= '<span class="month">' . $date->format('M') . '</span>';
$html .= '<span class="year">' . $date->format('Y') . '</span>';
$html .= '</div>';
$html .= '<div class="days">';
$dayLabels = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
foreach ($dayLabels as $dayLabel)
{
$html .= '<span class="day-label">' . $dayLabel . '</span>';
}
$get_events = CalendarEvents::where("event_date", ">=", date("Y-m-d", strtotime($startOfCalendar)))->get();
while ($startOfCalendar <= $endOfCalendar)
{
$extraClass = $startOfCalendar->format('m') != $date->format('m') ? 'dull' : '';
$extraClass .= $startOfCalendar->isToday() ? ' today' : '';
$startOfCalendarFormated = $startOfCalendar->format('j');
$startOfCalendarSqlFormat = $startOfCalendar->format('Y-m-d');
$html .= '<span class="day flip' . $extraClass . '"><span class="content">';
$filled = false;
foreach ($get_events as $events) {
if ($events->event_date == $startOfCalendarSqlFormat) {
$html .= $startOfCalendarFormated . '|' . $events->event_name . "<br>";
$filled = true;
}
}
if(!$filled){
$html .= "No events | {$startOfCalendarFormated}";
}
$html .= '</span></span>';
$startOfCalendar->addDay();
}
$html .= '</div></div>';
for the blade what do you enter to see this?
it would be just what i'm looking for, i need to see some data in a calendar and i haven't been able to view yet, this could be what i need but i didn't understand what to put in the blade to see the result
i installed a Joomla template and some errors are appearing in homepage, the Errors are related to the Sp Page Builder component.
How can i fix these errors?
Here's a document with the erros - https://drive.google.com/open?id=0B1toGflgmV7fZi1SQ051QWZxZFE
And the site.php
<?php
/**
* Flex 1.0 #package SP Page Builder
* Template Name - Flex
* #author Aplikko http://www.aplikko.com
* #copyright Copyright (c) 2015 Aplikko
* #license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
*/
// no direct access
defined('_JEXEC') or die;
JLoader::register('JHtmlString', JPATH_LIBRARIES.'/joomla/html/html/string.php');
AddonParser::addAddon('sp_latest_posts','sp_latest_posts_addon');
function get_categories($parent=1) {
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query
->select('*')
->from($db->quoteName('#__categories'))
->where($db->quoteName('extension') . ' = ' . $db->quote('com_content'))
->where($db->quoteName('published') . ' = ' . $db->quote(1))
->where($db->quoteName('parent_id') . ' = ' . $db->quote($parent))
->order($db->quoteName('created_time') . ' DESC');
$db->setQuery($query);
$cats = $db->loadObjectList();
$categories = array($parent);
foreach ($cats as $key => $cat) {
$categories[] = $cat->id;
}
return $categories;
}
function sp_latest_posts_addon($atts){
extract(spAddonAtts(array(
"title" => '',
"heading_selector" => 'h3',
"title_fontsize" => '',
"title_text_color" => '',
"title_margin_top" => '',
"title_margin_bottom" => '',
"show_image" => '',
"show_date" => '',
"show_category" => '',
"show_intro_text" => '',
"show_author" => '',
"item_limit" => '',
"intro_text_limit" => '100',
"column_no" => '3',
"image_alignment" => '',
"category" => '',
"style" => '',
"class" => '',
), $atts));
$app = JFactory::getApplication();
$doc = JFactory::getDocument();
// Database Query
require_once JPATH_SITE . '/components/com_content/helpers/route.php';
// Access filter
$access = !JComponentHelper::getParams('com_content')->get('show_noauth');
$authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query
->select('a.*')
->from($db->quoteName('#__content', 'a'))
->select($db->quoteName('b.alias', 'category_alias'))
->select($db->quoteName('b.title', 'category'))
->join('LEFT', $db->quoteName('#__categories', 'b') . ' ON (' . $db->quoteName('a.catid') . ' = ' . $db->quoteName('b.id') . ')')
->where($db->quoteName('b.extension') . ' = ' . $db->quote('com_content'))
->where($db->quoteName('a.state') . ' = ' . $db->quote(1))
->where($db->quoteName('a.catid')." IN (" . implode( ',', get_categories($category) ) . ")")
->where($db->quoteName('a.access')." IN (" . implode( ',', $authorised ) . ")")
->order($db->quoteName('a.created') . ' DESC')
->setLimit($item_limit);
$db->setQuery($query);
$items = $db->loadObjectList();
// End Database Query
$style == 'flex' ? $flex_style = ' flex' : '';
$style == 'blog' ? $blog_style = ' blog' : '';
$blog_style = $output = '<div class="sppb-addon sppb-addon-latest-posts'.$flex_style.$blog_style.' sppb-row ' . $class . '">';
if ($title) {
$output .= '<div class="sppb-section-title">';
$output .= '<'.$heading_selector.' class="sppb-addon-title" style="' . $title_style . '"> ' . $title . '</' . $heading_selector . '>';
$output .= '</div>'; // END :: title
}
$output .= '<div class="sppb-addon-content">';
$output .= '<div class="latest-posts clearfix">';
foreach(array_chunk($items, $column_no) as $items) {
$output .= '<div>';
foreach ($items as $item) {
$item->slug = $item->id . ':' . $item->alias;
$item->catslug = $item->catid . ':' . $item->category_alias;
$item->user = JFactory::getUser($item->created_by)->name;
if ($access || in_array($item->access, $authorised)) {
// We know that user has the privilege to view the article
$item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catid, $item->language));
$item->catlink = JRoute::_(ContentHelperRoute::getCategoryRoute($item->catslug, $item->catid, $item->language));
} else {
$item->link = JRoute::_('index.php?option=com_users&view=login');
$item->catlink = JRoute::_('index.php?option=com_users&view=login');
}
$tplParams = JFactory::getApplication()->getTemplate(true)->params;
$params = $item->params;
$attribs = json_decode($item->attribs);
$images = json_decode($item->images);
$imgsize = $tplParams->get('blog_list_image', 'default');
$intro_image = '';
if(isset($attribs->spfeatured_image) && $attribs->spfeatured_image != '') {
if($imgsize == 'default') {
$intro_image = $attribs->spfeatured_image;
} else {
$intro_image = $attribs->spfeatured_image;
$basename = basename($intro_image);
$list_image = JPATH_ROOT . '/' . dirname($intro_image) . '/' . JFile::stripExt($basename) . '_'. $imgsize .'.' . JFile::getExt($basename);
if(file_exists($list_image)) {
$intro_image = JURI::root(true) . '/' . dirname($intro_image) . '/' . JFile::stripExt($basename) . '_'. $imgsize .'.' . JFile::getExt($basename);
}
}
} elseif(isset($images->image_intro) && !empty($images->image_intro)) {
$intro_image = $images->image_intro;
}
if($column_no == '1') {
if ($show_image) {
$image_alignment == 'left' ? $img_column = 'sppb-col-sm-4 column-1 pull-left match-height' : $img_column = 'sppb-col-sm-4 column-1 pull-right match-height';
}
if ($show_image) {
$image_alignment == 'right' ? $content_column = 'sppb-col-sm-8 column-1 pull-left match-height' : $content_column = 'sppb-col-sm-8 column-1 pull-right match-height';
} else {
$image_alignment == 'right' ? $content_column = 'sppb-col-sm-12 column-1' : $content_column = 'sppb-col-sm-12 column-1';
}
$h2style = ' style="font-size:180%;line-height:1.4;"';
$img_wrapper_margin = ' style="margin:0;"';
if ($image_alignment == 'left') {
$inner_padding = ' style="padding:0 0 0 30px;"';
} else {
$inner_padding = ' style="padding:0 30px 0 0;"';
}
}
// match-height
$column_no > '1' ? $match_height = ' match-height' : '';
// Flex Style
if($style == 'flex') {
$output .= '<div class="latest-post sppb-col-sm-' . round(12/$column_no) . ' columns-'.$column_no.'">';
$output .= '<div class="latest-post-item">';
if($column_no == '1') {
$output .= '<div class="row-fluid">';
}
if(!empty($intro_image) || (isset($images->image_intro) && !empty($images->image_intro))) {
if ($show_image) {
if($column_no == '1') {
$output .= '<div style="padding:0" class="'.$img_column.'">';
}
$output .= '<div class="img-wrapper">';
$output .= '<img class="post-img" src="' . $intro_image . '" alt="' . $item->title . '" /><div class="caption-content">' . $item->title . '<em class="caption-category"><span class="posted-in">'. JText::_('COM_SPPAGEBUILDER_ADDON_POSTED_IN') .'</span>'. $item->category . '</em></div>';
$output .= '</div>';
if($column_no == '1') {
$output .= '</div>';
}
}
}
if($column_no == '1') {
$output .= '<div'.$inner_padding.' class="'.$content_column.'">';
}
$output .= '<div class="latest-post-inner match-height">';
if (($show_date || $show_intro_text || $show_author) != 1) {
$output .= '<h2 style="margin:0" class="entry-title">' . $item->title . '</h2>';
} else {
$output .= '<h2'.$h2style.' class="entry-title">' . $item->title . '</h2>';
}
if ($show_date) {
$output .= '<div class="entry-meta"><span class="entry-date">' . JHtml::_('date', $item->created, 'DATE_FORMAT_LC1') . '</span></div>';
}
if ($show_intro_text) {
$output .= '<p class="intro-text" >' . JHtml::_('string.truncate', strip_tags($item->introtext), $intro_text_limit) . '</p>';
}
$show_author || $show_category ? $output .= '<hr />' : '';
if ($show_author) {
$output .= '<span class="post-author"><span class="entry-author">' . JText::_('COM_SPPAGEBUILDER_ADDON_POSTED_BY'). '</span> ' . $item->user . '</span>';
}
if ($show_category) {
$show_author ? $posted_in_category = ' cat-inline' : '';
$output .= '<span class="category'.$posted_in_category.'"><span class="posted-in">'. JText::_('COM_SPPAGEBUILDER_ADDON_CATEGORY') .'</span>'. $item->category . '</span>';
}
if($column_no == '1') {
$output .= '</div>';
$output .= '</div>';
}
$output .= '</div>';
if($column_no == '1') {
$output .= '<div class="post-divider"></div>';
}
$output .= '</div>';
// Default & Blog styles
} else {
$output .= '<div class="latest-post sppb-col-sm-' . round(12/$column_no) . ' columns-'.$column_no.'">';
$output .= '<div class="latest-post-inner' . $match_height . '">';
if($column_no == '1') {
$output .= '<div class="row-fluid">';
}
if ($show_image) {
if($column_no == '1') {
$output .= '<div class="'.$img_column.'">';
}
$output .= '<div'.$img_wrapper_margin.' class="img-wrapper">';
$output .= '<img class="post-img" src="' . $intro_image . '" alt="' . $item->title . '" />';
$output .= '</div>';
if($column_no == '1') {
$output .= '</div>';
}
}
if($column_no == '1') {
$output .= '<div class="'.$content_column.'">';
}
if ($show_date) {
$output .= '<div class="entry-meta"><span class="entry-date"> ' . JHtml::_('date', $item->created, 'DATE_FORMAT_LC1') . '</span></div>';
}
$output .= '<h2'.$h2style.' class="entry-title">' . $item->title . '</h2>';
if ($show_intro_text) {
$output .= '<p class="intro-text" >' . JHtml::_('string.truncate', strip_tags($item->introtext), $intro_text_limit) . '</p>';
}
$show_author || $show_category ? $output .= '<hr />' : '';
if ($show_author) {
$output .= '<span class="post-author"><span class="entry-author">' . JText::_('COM_SPPAGEBUILDER_ADDON_POSTED_BY'). ' ' . $item->user . '</span></span>';
}
if ($show_category) {
$show_author ? $posted_in_category = ' cat-inline' : '';
$output .= '<span class="category'.$posted_in_category.'"><span class="posted-in">'. JText::_('COM_SPPAGEBUILDER_ADDON_CATEGORY') .'</span>'. $item->category . '</span>';
}
if($column_no == '1') {
$output .= '</div>';
$output .= '</div>';
}
$output .= '</div>';
}
$output .= '</div>';
}
$output .= '</div>';
}
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
$column_no == '1' ? $column_no_1 = '.column-1 {margin:10px auto;padding:0!important;}' : '';
// Add styles #media rulepost-img
if($style == 'flex') {
$custom_style = ''
. '#media screen and (max-width: 768px) {'
. $column_no_1
. '.img-wrapper a {font-size:150%;line-height:1.5;}'
. '}';
$doc->addStyleDeclaration($custom_style);
}
if ($column_no>='3') {
$custom_style_3 = ''
. '#media screen and (min-width: 992px) and (max-width: 1199px){'
. '.columns-'.$column_no.'{width:33.3333%;}'
. '}'
. '#media screen and (min-width: 768px) and (max-width: 991px){'
. '.columns-'.$column_no.'{width:50%}'
. '}';
$doc->addStyleDeclaration($custom_style_3);
}
if($column_no=='5') {
$custom_style_5 = ''
. '.columns-'.$column_no.' {width:20%}'
. '#media screen and (min-width: 992px) and (max-width: 1199px){'
. '.columns-'.$column_no.'{width:33.3333%;}'
. '}'
. '#media screen and (min-width: 768px) and (max-width: 991px){'
. '.columns-'.$column_no.'{width:50%}'
. '}'
. '#media screen and (max-width: 767px){'
. '.columns-'.$column_no.'{width:100%}'
. '}';
$doc->addStyleDeclaration($custom_style_5);
}
return $output;
}
Thanks!
There is many errors, but all of them are variable that have not been declared before using it, as example :
$style == 'flex' ? $flex_style = ' flex' : '';
$style == 'blog' ? $blog_style = ' blog' : '';
$blog_style = $output = '<div class="sppb-addon sppb-addon-latest-posts'.$flex_style.$blog_style.' sppb-row ' . $class . '">';
In this case $flex_style and $blog_style are not declared, you should write this instead :
$flex_style = style == 'flex' ? ' flex' : '';
$blog_style = $style == 'blog' ? ' blog' : '';
That is just an example, but if you search a little you'll find other issue like this one.
i am using the Favorites plugin in Wordpress to save posts. I'm trying to adjust the way the information is displayed though. All the styling etc works below and my divs are being included, however i am struggling to pull information through to fill the divs. Fore example, i am trying to pull the excerpt in to the p.details but it is just throwing out an empty result, with no errors. Similarly, i am trying to pull through an acf custom field of 'bath' into p.bath but that is also empty. Any suggestions? Thanks in advance.
if ( is_multisite() ) switch_to_blog($this->site_id);
$out = '<ul class="property-list" data-userid="' . $this->user_id . '" data-links="true" data-siteid="' . $this->site_id . '" ';
$out .= ( $include_button ) ? 'data-includebuttons="true"' : 'data-includebuttons="false"';
$out .= ( $this->links ) ? ' data-includelinks="true"' : ' data-includelinks="false"';
$out .= ' data-nofavoritestext="' . $no_favorites . '"';
$out .= ' data-posttype="' . $post_types . '"';
$out .= '>';
foreach ( $favorites as $key => $favorite ){
$out .= '<li data-postid="' . $favorite . '">';
$out .= '<div class="third-1">';
$out .= '<a class="property-thumb" href="' . get_permalink($favorite) . '">';
$out .= '</a>';
$out .= '</div>';
$out .= '<div class="third-2">';
if ( $this->links ) $out .= '<h3 class="name"><a href="' . get_permalink($favorite) . '">';
$out .= get_the_title($favorite);
if ( $this->links ) $out .= '</a></h3>';
if ( $this->links ) $out .= '<h4 class="price">';
$out .= '£' . '300';
if ( $this->links ) $out .= '</h4>';
if ( $this->links ) $out .= '<p class="details">';
$out .= the_excerpt();
if ( $this->links ) $out .= '</p>';
if ( $this->links ) $out .= '<p class="bed">';
$out .= '1';
if ( $this->links ) $out .= '</p>';
if ( $this->links ) $out .= '<p class="bath">';
$out .= '1';
if ( $this->links ) $out .= '</p>';
if ( $this->links ) $out .= '<a class="full-details" href="' . get_permalink($favorite) . '">';
$out .= 'Full details';
if ( $this->links ) $out .= '</a>';
if ( $this->links ) $out .= '<a class="book-viewing" href="' . get_permalink($favorite) . '">';
$out .= 'Book Viewing';
if ( $this->links ) $out .= '</a>';
$out .= '</div>';
$out .= '</li>';
}
Change the_excerpt(); to get_the_excerpt(); and it should work.
I'm having an error in laravel 4.2
"Trying to get property of non object"
It was working good before and so I don't know why it's not working now.
This is my code:
Controller:
public function id($lang,$id,$vers) {
// $Agent = new Agent();
// if ($Agent->isMobile()) {
// $data['settings'] = Courses::settings($id, $vers);
// $this->layout->content = View::make('gui.mobile')->with('data', $data);
// } else {
$data['index'] = Courses::productsIndex($id);
$data['langs'] = Courses::langsclient($id);
$data['settings'] = Courses::settings($id, $vers);
$this->layout->content = View::make('gui.home')->with('data', $data);
// }
}
model:
public static function productsIndex($id,$html='') {
$clients = DB::table('clients')->where('client_id',$id)->first();
$clients_settings = DB::table('clients_settings')->where('clients_id',$id)->first();
$courss = explode(',', $clients->products);
$IndexCats = '';
$IndexCats .= '' . trans('home.All Products') .'';
foreach($courss as $index) {
$IndexCats .= '' . trans('home.' . $index) . '';
}
$clients = DB::table('clients')->where('client_id',$id)->first();
$cours = explode(',', $clients->coruses);
$tabs ='';
$links='';
foreach($cours as $row) {
$idcours = DB::table('courses')->where('id',$row)->get();
$coursCount = DB::table('lessons')->where('courses_id',$row)->count();
$clients_settings = DB::table('clients_settings')->where('clients_id',$id)->first();
$clients_images_ebook = DB::table('mediameneger')->where('name','ebook')->where('type','image')->where('client_id',$id)->first();
if($row == 'ebook') {
$image_ebook = !empty($clients_images_ebook->fullpath) ? $clients_images_ebook->fullpath : url() .'/files/images/ebook.jpg';
$tabs .= '<li class="videos ebook" style="background-image: url(' . $image_ebook . '?86400' .');">';
$tabs .= '<p><a href="'. url() .'/gui/' . Request::segment(2) . '/'. $id .'/' . Request::segment(4) . '/ebooks">Ebook';
$tabs .= '<span class="more"><br />';
$tabs .= '<i class="hidden-xs cercale glyphicon glyphicon-book fa-3x"></i></span>';
$tabs .= '</a></p>';
$tabs .= '</li>';
}
if($row == 'ebook_forex') {
$image_ebook = !empty($clients_images_ebook->fullpath) ? $clients_images_ebook->fullpath : url() .'/files/images/ebook.jpg';
$tabs .= '<li class="videos ebook" style="background-image: url(' . $image_ebook . '?86400'.');">';
$tabs .= '<p><a href="'. url() .'/gui/' . Request::segment(2) . '/'. $id .'/' . Request::segment(4) . '/ebooks_forex">Ebook Forex';
$tabs .= '<span class="more"><br />';
$tabs .= '<i class="hidden-xs cercale glyphicon glyphicon-book fa-3x"></i></span>';
$tabs .= '</a></p>';
$tabs .= '</li>';
}
if($row == 'chats') {
$image_ebook = !empty($clients_images_ebook->fullpath) ? $clients_images_ebook->fullpath : url() .'/files/images/chat.jpg';
$tabs .= '<li class="videos chats" style="background-image: url(' . $image_ebook . '?86400'.');">';
$tabs .= '<p><a href="'. url() .'/gui/' . Request::segment(2) . '/'. $id .'/' . Request::segment(4) . '/chats">Chat with an expert';
$tabs .= '<span class="more"><br />';
$tabs .= '<i class="hidden-xs cercale fa fa-weixin fa-3x"></i></span>';
$tabs .= '</a></p>';
$tabs .= '</li>';
}
foreach($idcours as $row2) {
$lang = !empty(Session::get('local')) ? Session::get('local') : 'gb';
$showbox = DB::table('mediameneger')->where('course',$row2->id)->where('lang', $lang)->limit(1)->get();
$clients_images = DB::table('mediameneger')->where('course',$row2->id)->where('type','image')->where('client_id',$id)->first();
foreach ($showbox as $key) {
$lang = Session::get('local') != null ? Session::get('local') : Request::segment(2);
$image = !empty($clients_images->fullpath) ? $clients_images->fullpath : $row2->imagepath;
$tabs .= '<li class="videos" style="background-image: url('. $image . '?86400' .');">';
$tabs .= '<p><a href="'. url() .'/gui/' . $lang . '/' . $id .'/' . Request::segment(4) . '/lessons/' . $row2->id . '">' . trans('home.'. $row2->name . '') . '';
$tabs .= '<span class="more"><i class="text">' . $coursCount . ' ' . trans('home.lessonstotal') .'</i><br />';
$tabs .= '<i class="hidden-xs cercale glyphicon glyphicon-play fa-3x"></i></span>';
$tabs .= '</a></p>';
$tabs .= '</li>';
}
}
}
$tabs .='<li style="overflow: hidden; clear: both; height: 0; position: relative; float: none; display: block;"></li>';
$data['tabs'] = $tabs;
$data['IndexCats'] = $IndexCats;
return $data;
}
The errors is from all the explode();
and I don't know why is working before.
Try to run command "php artisan dump-autoload" and composer "dump-autoload".
Log out of your website and then log back in. This usually happens when you leave the local development server alone for a bit.
I am trying to add for a Bootstrap Theme at OSCommerce an active class for manufacturors. I am a noob with PHP and cant finish it.. Anybody who can help me out?
The Code
$manufacturers_list = '<ul class="nav nav-pills nav-stacked">';
while ($manufacturers = tep_db_fetch_array($manufacturers_query))
{
$manufacturers_name = ((strlen($manufacturers['manufacturers_name']) > MAX_DISPLAY_MANUFACTURER_NAME_LEN) ? substr($manufacturers['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '..' : $manufacturers['manufacturers_name']);
if (isset($HTTP_GET_VARS['manufacturers_id']) && ($HTTP_GET_VARS['manufacturers_id'] == $manufacturers['manufacturers_id']))
$manufacturers_name = '<strong>' . $manufacturers_name .'</strong>';
$manufacturers_list .= '<li>' . $manufacturers_name . '</li>';
}
$manufacturers_list .= '</ul>';
I thought I could do it code it like here
$manufacturers_list .= '<li><a' if (isset($manufacturor_name)) {echo "class="'active'} ' href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers['manufacturers_id']) . '">' . $manufacturers_name . '</a></li>';
Thanks for advices.
You can't have an if statement in between strings, concatenate using . and the ternary operator ?::
$manufacturers_list .= '<li><a '.(isset($manufacturor_name) ? 'class="active"' : '').'href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers['manufacturers_id']) . '">' . $manufacturers_name . '</a></li>';