Using version TYPOlight 2.6.7
Posting news article using TYPOlight’s ‘News’ module have different fields to enter. To eliminate unnecessary repetition of input (e.g. image size, and float to left or right), I just created a simpler way, to my liking of a news module.

It’s a small hack and CSS play.

Here’s how: Copy the news_full.tpl
mysite/system/modules/news/templates/news_full.tpl

then add this code (300px-optional size as a sample for main picture)

<img src="<?php echo($this->getImage($this->href, 300, 0)); ?>" alt="<?php echo $this->alt; ?>"/><?php if ($this->fullsize): ?></a><?php endif; ?> 

Save this file to your templates
mysite\templates\news_sample_tpl

<div class="layout_full block<?php echo $this->class; ?>">

<h1><?php echo $this->newsHeadline; ?></h1>
<?php if ($this->hasMetaFields): ?>

<p class="info"><?php echo $this->date; ?> <?php echo $this->author; ?> <?php echo $this->commentCount; ?></p>
<?php endif; ?>
<?php if ($this->hasSubHeadline): ?>

<h2><?php echo $this->subHeadline; ?></h2>
<?php endif; ?>

<div class="ce_text">
<?php if ($this->addImage): ?>
<div class="image_container"<?php if ($this->margin || $this->float): ?> style="<?php echo $this->margin . $this->float; ?>"<?php endif; ?>>
<?php if ($this->fullsize): ?><a href="<?php echo $this->href; ?>" title="<?php echo $this->alt; ?>" rel="lightbox"><?php endif; ?> 
<img src="<?php echo($this->getImage($this->href, 300, 0)); ?>" alt="<?php echo $this->alt; ?>"/><?php if ($this->fullsize): ?></a><?php endif; ?>
<?php if ($this->caption): ?>
<div class="caption"><?php echo $this->caption; ?></div>
<?php endif; ?>
</div>
<?php endif; ?>
<?php echo $this->text; ?>
</div>
<?php if ($this->enclosure): ?>

<div class="enclosure">
<?php foreach ($this->enclosure as $enclosure): ?>
<p><img src="<?php echo $enclosure&#91;'icon'&#93;; ?>"<?php echo $enclosure&#91;'size'&#93;; ?> alt="<?php echo $enclosure&#91;'title'&#93;; ?>" class="mime_icon" /> <a href="<?php echo $enclosure&#91;'href'&#93;; ?>" title="<?php echo $enclosure&#91;'title'&#93;; ?>"><?php echo $enclosure&#91;'link'&#93;; ?></a></p>
<?php endforeach; ?>
</div>
<?php endif; ?>

Create a module:
Modules > Add module >
Add info and select the ‘News template,’ browse and select the news template you created, e.g. ‘news_main.tpl.’ >Save and Close

If you haven’t created a ‘news reader’ (full story of the news), go to the ‘Site structure > add New page >add another Page
*Note that I’m using the default web site sample of TYPOlight.

Sample:
news1

Create article:
Articles > New article >

Sample:
news2

Then, insert your created news template using the element type > module

Sample output of news article
testfull1

Done! The only irritating part are posting the codes in WordPress.

Advertisements