Jump to content

Pages - Custom block with the article view


Marius

Recommended Posts

Is possible to add a custom block that has the article view (exactly as the article mode for index pages)?

articlemode.thumb.jpg.6579599834c7760067

I would like this custom block to display a list of records with their title, a truncated content field, main image and comment and view count. Is this possible?

 

Link to comment
Share on other sites

Unfortunately I do not think anyone will help us.
I don't know what to think and I see that I made a mistake when I bought IP.Pages, I just wasted money, because I can not use it.
Waiting for several months the documentation for use IP.Pages be published, but it no longer appears. Only few articles have been published that are insufficient and that does not help us much on those who do not have advanced technical knowledge.
It was more correctly if IPS clearly says that IP.Pages only can be used by developers or those who know to write code. The only option for us is to pay a developer to have a first page with articles.

Link to comment
Share on other sites

Unfortunately I do not think anyone will help us.

Give it some time. You posted your request just yesterday and I might even write the code for it and post it on the forums. But you can’t expect that someone just drops anything he/she is doing just to instantly customize some code for you. It takes some time. 

 

I don't know what to think and I see that I made a mistake when I bought IP.Pages, I just wasted money, because I can not use it.

What are you struggling with? Describe it and we can help. Choosing a preferred layout and “not being able to use it” are different things though, I think. 

 

It was more correctly if IPS clearly says that IP.Pages only can be used by developers or those who know to write code. 

I disagree of course. Check the lastest pages documentation articles on setting up a database and customizing a database. As an example, they describe how to set up a movie review site without the slightest developer knowledge. It’s all done with just the ACP options anyone can use. 

But of course if you cannot do customization work yourself or can’t pay someone to do it for you, than you have to live with the default options and layouts (as used in those articles). That’s just in the nature of these things. 

 

The staff don't seem interested to help much with pages. 

We must use different forums then. ;-)

But keep in mind: Official Pages support and customization help are two different things. I try to answer every Pages question I see in this forum and at least point people in the right direction, i.e. tell them what the software can and can’t do, where to find things in the ACP and things like that. That’s exactly what I also did in this topic. 
But of course the IPS staff members aren’t your free web developers who help you learn to code or even write any code for you if you just ask in the forums. That can’t work and that’s why we will often not take part in these lengthy customization topics you linked above. They just aren’t cases for official support. They are community topics where members are asking for help from other members. And there is nothing wrong with that of course. 

Link to comment
Share on other sites

While I'm in the same boat as Marius and others I  also recognize (and accept) what  Ralf  is saying.

I'm certain the block we need — or one sufficiently like it — will eventually appear as either a marketplace item or a user-contribution or like the article-grid, a mercy post :P 

While I do find it frustrating that I can't yet accomplish certain things that seem like they should be doable by casual users, fortunately Pages has quite a lot of bits to it that *are*  useful right now, even with with my limited abilities, so I don't regret buying it for my self-hosted license and am glad it is included in the hosting. 

 

Link to comment
Share on other sites

Okay, here it comes. It gets you from this default view of article feed blocks …

Bildschirmfoto_2015-08-22_um_07.32.10.th

… to this:

Bildschirmfoto_2015-08-22_um_08.18.08.th

Make sure you have a block set up which is a feed from a Pages database. It should have the usual title and content fields in use and the record image if needed. Choose “use as base for custom template” and then replace the default code there with this:

{{if !empty( $records ) }}
	<h3 class='ipsWidget_title ipsType_reset'>{lang="block_latest_records" sprintf="$database->recordWord( 2, TRUE )"}</h3>

{{if $orientation == 'vertical'}}
		<div class='ipsPad_half ipsWidget_inner'>
			<ul class='ipsDataList ipsDataList_reducedSpacing'>
				{{foreach $records as $record}}
					<li class='ipsDataItem'>
						<div class='ipsDataItem_icon ipsPos_top'>
							{template="userPhoto" group="global" app="core" params="$record->author(), 'tiny'"}
						</div>
						<div class='ipsDataItem_main'>
							<div class="ipsCommentCount ipsPos_right {{if ( $record->record_comments ) === 0}}ipsFaded{{endif}}" data-ipsTooltip title='{lang="replies_number" pluralize="$record->record_comments"}'>{expression="$record->record_comments"}</div>
							<a href="{$record->url()->setQueryString( 'do', 'getLastComment' )}" title='{lang="view_this_cmsrecord" sprintf="\IPS\Member::loggedIn()->language()->addToStack( 'content_db_lang_sl_' . $record::$customDatabaseId, FALSE ), $record->_title"}' class='ipsDataItem_title ipsType_break'>{wordbreak="$record->_title"}</a><br>
							<span class='ipsType_light ipsType_small'>{lang="byline_nodate" htmlsprintf="$record->author()->link()"} · {datetime="$record->mapped('date')"}</span>
						</div>
					</li>
				{{endforeach}}
			</ul>
		</div>
	{{else}}

	
{{foreach $records as $record}}
					
 <article class='cCmsCategoryFeaturedEntry {{if $record->hidden()}}ipsModerated{{endif}}'>
	<header class='ipsPhotoPanel ipsPhotoPanel_notPhone ipsPhotoPanel_small ipsSpacer_bottom'>
		{template="userPhoto" app="core" params="$record->author()" group="global"}
		<div> 
			<h2 class='ipsType_pageTitle'>
				{{if $record->prefix()}}
				{template="prefix" group="global" app="core" params="$record->prefix( TRUE ), $record->prefix()"}
				{{endif}}
				<a href="{$record->url()}" title="{lang="read_more_about" sprintf="$record->_title"}">
					{{if $record->unread()}}
					<span class='ipsItemStatus' data-ipsTooltip title="{lang="cms_unread_record"}"><i class="fa fa-circle"></i></span>
					{{endif}}
					{wordbreak="$record->_title"}
				</a>
			</h2>
			<p class='ipsType_light ipsType_reset'>
				{lang="byline" htmlsprintf="$record->author()->link(), $record->container()->_title"}{datetime="$record->record_publish_date"}
			</p>
		</div>
	</header>
	
                
                
	<section class='ipsClearfix ipsType_normal ipsType_richText ipsType_break ipsSpacer_both' data-ipsTruncate data-ipsTruncate-size='7 lines' data-ipsTruncate-type='remove'>
      
    {{if $record->record_image}}
		<div><img style="float:left;margin-top:4px;margin-right:6px;max-width:200px;max-height:200px;" class="ipsImage" src="{file="$record->record_image" extension="cms_Records"}"></div>
	{{endif}}
	{$record->truncated()|raw}
	</section>
	{{if count( $record->tags() )}}
		{template="tags" group="global" app="core" params="$record->tags()"}
	{{endif}}
	<ul class='ipsList_inline'>
		<li><strong><a href='{$record->url()}' title="{lang="read_more_about" sprintf="$record->name"}">{lang="read_more"}</a></strong></li>
		{{if $record::database()->options['reviews']}}
		<li>{template="rating" app="core" params="'small', $record->averageReviewRating(), \IPS\Settings::i()->reviews_rating_out_of" group="global"}</li>
		{{endif}}
		<li><a href='{$record->url()}#comments' title='{lang="view_comments"}'><i class='fa fa-comment'></i> {lang="num_comments" pluralize="$record->record_comments"}</a></li>
		<li class='ipsType_light'>{lang="num_views_with_number" pluralize="$record->record_views"}</li>
	</ul>
</article>
<hr class='ipsHr'>              
                        
  {{endforeach}}
 {{endif}}
{{endif}}

 

Link to comment
Share on other sites

@Ralf Herrmann, I want to remove the user's photo, located on top near the title.
I tried to eliminate this part

<div class='ipsDataItem_icon ipsPos_top'>
							{template="userPhoto" group="global" app="core" params="$record->author(), 'tiny'"}
						</div>

but does not seem to work.

What part of code should take it off?

Thank you.

Link to comment
Share on other sites

I'm not Ralf but this is how I eliminate the photo:

I believe the first chunk of code applies to the block when it is in vertical or sidebar position. Scroll down and you'll see another section  following {else} where you can comment out or delete the user photo code.

<article class='cCmsCategoryFeaturedEntry {{if $record->hidden()}}ipsModerated{{endif}}'>
	
   <header class='ipsSpacer_bottom'>
		<!-- {template="userPhoto" app="core" params="$record->author()" group="global"} -->
		

 

Link to comment
Share on other sites

A few minor alterations and another variation on it if anyone wants it.

Capture.thumb.PNG.32a824f232be2b0e5a0c14

{{if !empty( $records ) }}

{{if $orientation == 'vertical'}}
		<div class='ipsPad ipsWidget_inner'>
			<ul class='ipsDataList ipsDataList_reducedSpacing'>
				{{foreach $records as $record}}
					<li class='ipsDataItem'>
						<div class='ipsDataItem_icon ipsPos_top'>
							{template="userPhoto" group="global" app="core" params="$record->author(), 'tiny'"}
						</div>
                      
						<div class='ipsDataItem_main'>
							<div class="ipsCommentCount ipsPos_right {{if ( $record->record_comments ) === 0}}ipsFaded{{endif}}" data-ipsTooltip title='{lang="replies_number" pluralize="$record->record_comments"}'>{expression="$record->record_comments"}</div>
							<a href="{$record->url()->setQueryString( 'do', 'getLastComment' )}" title='{lang="view_this_cmsrecord" sprintf="\IPS\Member::loggedIn()->language()->addToStack( 'content_db_lang_sl_' . $record::$customDatabaseId, FALSE ), $record->_title"}' class='ipsDataItem_title ipsType_break'>{wordbreak="$record->_title"}</a><br>
							<span class='ipsType_light ipsType_small'>{lang="byline_nodate" htmlsprintf="$record->author()->link()"} · {datetime="$record->mapped('date')"}</span>
						</div>
					</li>
				{{endforeach}}
			</ul>
		</div>
	{{else}}

{{foreach $records as $record}}
					
 <article class='ipsPad_half ipsWidget_inner cCmsCategoryFeaturedEntry {{if $record->hidden()}}ipsModerated{{endif}}'>
	<header class='ipsPhotoPanel ipsPad  ipsAreaBackground ipsPhotoPanel_notPhone ipsPhotoPanel_small ipsSpacer_bottom'>
		{template="userPhoto" app="core" params="$record->author()" group="global"}
		<div> 
			<h2 class='ipsType_pageTitle'>
				{{if $record->prefix()}}
				{template="prefix" group="global" app="core" params="$record->prefix( TRUE ), $record->prefix()"}
				{{endif}}
				<a href="{$record->url()}" title="{lang="read_more_about" sprintf="$record->_title"}">
					{{if $record->unread()}}
					<span class='ipsItemStatus' data-ipsTooltip title="{lang="cms_unread_record"}"><i class="fa fa-circle"></i></span>
					{{endif}}
                  <strong>{wordbreak="$record->_title"}</strong>
				</a>
			</h2>
			<p class='ipsType_light ipsType_reset'>
				{lang="cms_byline" htmlsprintf="$record->author()->link(), $record->container()->url(), $record->container()->_title"}{datetime="$record->record_publish_date"}<br><span class='ipsType_light'><i class='fa fa-eye'></i> {lang="num_views_with_number" pluralize="$record->record_views"}</span>
			</p>
		</div>
	</header>
   
                
	<section class='ipsClearfix ipsPad_half ipsType_normal ipsType_richText ipsType_break' data-ipsTruncate data-ipsTruncate-size='7 lines' data-ipsTruncate-type='remove'>
      
    {{if $record->record_image}}
		<div><img style="float:left;margin-top:4px;margin-right:6px;max-width:200px;max-height:200px;" class="ipsImage" src="{file="$record->record_image" extension="cms_Records"}"></div>
      
	{{endif}}
      
	{$record->truncated()|raw}
	</section>
	{{if count( $record->tags() )}}
		{template="tags" group="global" app="core" params="$record->tags()"}
	{{endif}}
	<ul class='ipsList_inline ipsPad'>
      
		{{if $record::database()->options['reviews']}}
		<li>{template="rating" app="core" params="'small', $record->averageReviewRating(), \IPS\Settings::i()->reviews_rating_out_of" group="global"}</li>
		{{endif}}
      
		<li><a href='{$record->url()}#comments' title='{lang="view_comments"}'><i class='fa fa-comment'></i> {lang="num_comments" pluralize="$record->record_comments"}</a></li>
     
      <li><strong><a href='{$record->url()}' title="{lang="read_more_about" sprintf="$record->name"}">{lang="read_more"}</a></strong></li>
      
	</ul>
</article>
           
                        
  {{endforeach}}
 {{endif}}
{{endif}}

 

Link to comment
Share on other sites

Hello,

We have a problem with this block.
If we use the block on a page that has not associated with any database, the link under the article title that leads to the categories created in the database is not correct. Link under the category name contains the name of the page, instead of having the database name.

55d975d12664d_Captur_de_ecran_din_2015.0

I think the problem is caused by this code

<p class='ipsType_light ipsType_reset'>
				{lang="cms_byline" htmlsprintf="$record->author()->link(), $record->container()->url(), $record->container()->_title"}{datetime="$record->record_publish_date"}

more precisely that

$record->container()->url(), $record->container()->_title

Is there any way to solve it?

Thank you.

Link to comment
Share on other sites

Right. 

You might just remove the category information with the wrong link.

Replace:

{lang="cms_byline" htmlsprintf="$record->author()->link(), $record->container()->url(), $record->container()->_title"}

With:

{lang="byline" htmlsprintf="$record->author()->link()"}

 

Hello Ralf, and "do you know" how to show the database articles with full format (show videos, images, list... exactly like the article view)... photoshop made:

 

s.png

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...