Mark List item as New

2 years 11 months ago #58295 by eifelnetz
Hello, in the Module "default-news.php" I like to add a "NEW" text in the beginning of the Article-List, when the creation Date is earlier then X-Days (e.g. 4 Days) from today. Here is a Solution for a "normal" Joomla-Page: http://forum.joomla-nafu.de/joomla!-allgemein/beitrage-als-'neu'-markieren/msg83/ .

I tried to calculate with "$item->date_created;", but it doenst work.

How is the Solution for this flexicontent Module?

Thx!
Michael

Please Log in or Create an account to join the conversation.

2 years 11 months ago #58296 by micker
Replied by micker on topic Mark List item as New
can you post your code to understand ?

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

2 years 11 months ago #58297 by eifelnetz
Replied by eifelnetz on topic Mark List item as New
Here is the Code of the original default-news.php in modules/mod_flexicontent/tmpl
<?php // no direct access
defined('_JEXEC') or die('Restricted access');
?>

<div class="default mod_flexicontent_wrapper mod_flexicontent_wrap<?php echo $moduleclass_sfx; ?>" id="mod_flexicontent_default<?php echo $module->id ?>">
	
	<?php
	// Display FavList Information (if enabled)
	include(JPATH_SITE.'/modules/mod_flexicontent/tmpl_common/favlist.php');
	
	// Display Category Information (if enabled)
	include(JPATH_SITE.'/modules/mod_flexicontent/tmpl_common/category.php');
	
	$ord_titles = array(
		'popular'=>JText::_( 'FLEXI_MOST_POPULAR'),
		'commented'=>JText::_( 'FLEXI_MOST_COMMENTED'),
		'rated'=>JText::_( 'FLEXI_BEST_RATED' ),
		'added'=>	JText::_( 'FLEXI_RECENTLY_ADDED'),
		'addedrev'=>JText::_( 'FLEXI_RECENTLY_ADDED_REVERSE' ),
		'updated'=>JText::_( 'FLEXI_RECENTLY_UPDATED'),
		'alpha'=>	JText::_( 'FLEXI_ALPHABETICAL'),
		'alpharev'=>JText::_( 'FLEXI_ALPHABETICAL_REVERSE'),
		'id'=>JText::_( 'FLEXI_HIGHEST_ITEM_ID'),
		'rid'=>JText::_( 'FLEXI_LOWEST_ITEM_ID'),
		'catorder'=>JText::_( 'FLEXI_CAT_ORDER'),
		'random'=>JText::_( 'FLEXI_RANDOM' ),
		'field'=>JText::_( 'FLEXI_CUSTOM_FIELD' ),
		 0=>'Default' );
	
	$separator = "";
	
	foreach ($ordering as $ord) :
  	echo $separator;
	  if (isset($list[$ord]['featured']) || isset($list[$ord]['standard'])) {
  	  $separator = "<div class='ordering_seperator' ></div>";
    } else {
  	  $separator = "";
  	  continue;
  	}
	?>
	<div id="<?php echo 'order_'.( $ord ? $ord : 'default' ) . $module->id; ?>" class="mod_flexicontent">
		
		<?php	if ($ordering_addtitle && $ord) : ?>
		<div class='order_group_title'><?php echo $ord_titles[$ord]; ?></div>
		<?php endif; ?>
		
		<?php if (isset($list[$ord]['featured'])) : ?>
		<!-- BOF featured items -->
		<ul class="mod_flexicontent<?php echo $moduleclass_sfx; ?> mod_flexicontent_featured">
			
			<?php foreach ($list[$ord]['featured'] as $item) : ?>
			<li class="<?php echo $item->is_active_item ? 'fcitem_active' : ''; ?>" >
				<?php if ($add_tooltips) : ?>
				<a href="<?php echo $item->link; ?>"
						class="hasTip fcitem_link"
						title="<?php echo htmlspecialchars($item->fulltitle, ENT_COMPAT, "UTF-8").'::'.htmlspecialchars($item->text, ENT_COMPAT, "UTF-8"); ?>">
					<?php echo $item->date_created; ?>: <b><?php echo $item->title; ?>
				</a></b>
				<?php else : ?>
				<a href="<?php echo $item->link; ?>"><?php echo $item->title; ?></a>
				<?php endif; ?>
			</li>
			<!-- EOF current item -->
			<?php endforeach; ?>
			
		</ul>
		<!-- EOF featured items -->
		<?php endif; ?>
		
		
		<?php if (isset($list[$ord]['standard'])) : ?>
		<!-- BOF standard items -->
		
		<ul class="mod_flexicontent<?php echo $moduleclass_sfx; ?> mod_flexicontent_standard">
			
			<?php foreach ($list[$ord]['standard'] as $item) : ?>
			<li class="<?php echo $item->is_active_item ? 'fcitem_active' : ''; ?>" >
				<?php if ($add_tooltips) : ?>
				<a href="<?php echo $item->link; ?>"
						class="hasTip fcitem_link"
						title="<?php echo htmlspecialchars($item->fulltitle, ENT_COMPAT, "UTF-8").'::'.htmlspecialchars($item->text, ENT_COMPAT, "UTF-8"); ?>">
					<?php echo $item->title; ?>
				</a>
				<?php else : ?>
				<a href="<?php echo $item->link; ?>"><?php echo $item->title; ?></a>
				<?php endif; ?>
			</li>
			<!-- EOF current item -->
			<?php endforeach; ?>
			
		</ul>
		<!-- EOF standard items -->
		<?php endif; ?>
		
	</div>
	<?php endforeach; ?>
	
	<?php
	// Display readon of module
	include(JPATH_SITE.'/modules/mod_flexicontent/tmpl_common/readon.php');
	?>
	
</div>

And this is the code from http://forum.joomla-nafu.de/joomla!-allgemein/beitrage-als-'neu'-markieren/msg83/ , where they explain, how to mark as new
$date = JFactory::getDate($this->item->created); // in Kategrorieansichten
$date = JFactory::getDate($this->article->created); // in der Beitragsansicht
$now = JFactory::getDate();
$days = '3';

echo $now->diff($date)->format('%a') <= $days ? ' new-article' : '';

thx!

Please Log in or Create an account to join the conversation.

2 years 11 months ago #58298 by micker
Replied by micker on topic Mark List item as New
did you see you have markup option in category view ?

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

2 years 11 months ago #58300 by eifelnetz
Replied by eifelnetz on topic Mark List item as New
Oh no, I didn't. Where can I find it (in the mod_flexicontent too)? And can select, for how long this ist marked up?

Please Log in or Create an account to join the conversation.

2 years 11 months ago #58301 by micker
Replied by micker on topic Mark List item as New
In catégorie option or global config
Markup tab all is in
For universal universal module not sûre
Gobto item display tab

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

2 years 11 months ago - 2 years 11 months ago #58307 by ggppdk
Replied by ggppdk on topic Mark List item as New
Hello

the item list markups (Item lists: Markups TAB in component parameters) for category-like views (category, multi-cats, tags, search)
- do what you ask and more

they add custom text and CSS class according to
- creation date
- modified date
- access levels
- featured categories
- not featured (normal) categories

but these are not yet added to universal module


it should look like (but need to change variable names etc)
(e.g. foreach($items as $item) is different inside the module file it is foreach($list[$ord][...] as $item)

// Calculate CSS classes needed to add special styling markups to the items
		flexicontent_html::calculateItemMarkups($items, $params);

<?php foreach ($items as $i => $item) : ?>
		<?php
		$fc_item_classes = 'sectiontableentry';
		
		$markup_tags = '<span class="fc_mublock">';
		foreach($item->css_markups as $grp => $css_markups) {
			if ( empty($css_markups) )  continue;
			$fc_item_classes .= ' fc'.implode(' fc', $css_markups);
			
			$ecss_markups  = $item->ecss_markups[$grp];
			$title_markups = $item->title_markups[$grp];
			foreach($css_markups as $mui => $css_markup) {
				$markup_tags .= '<span class="fc_markup mu' . $css_markups[$mui] . $ecss_markups[$mui] .'">' .$title_markups[$mui]. '</span>';
			}
		}
		$markup_tags .= '</span>';
		...
		// PRINT THE markups tags
		<div class="fcclear fc_beforemarkups"></div>
		<?php echo $markup_tags; ?>
		...


-- FLEXIcontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

2 years 11 months ago #58308 by ggppdk
Replied by ggppdk on topic Mark List item as New
and in compoent parameter configuration you could use
"MY_STRING_NEW" when e.g. creation date is within some limits

but this a work that we should do


-- FLEXIcontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

2 years 11 months ago #58334 by eifelnetz
Replied by eifelnetz on topic Mark List item as New
Many thanks! My solution:
I have replaced the module by a category view and set the markup in the global configuration.
"Konfiguration" -> "Flexicontent" -> "Lists: Markups" -> "Kürzlich hinzugefügte Markups" -> "Ja / Ja" / "24h , 3d , 7d , 14d" / "NEU, 3 Tage , 7 Tage, 14 Tage"

:)

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
© 2018 Flexicontent. All Rights Reserved.