, Guest!
Already a Member? Login or Register.

Menu



Showcase


Due to the volume of spam happening on our forums, posting is now restricted to verified members only.  If you're not verified, drop us a note with your username.

Home > FlexCMS Support Forum > User Help > General Support Requests > ARTICLES FORMATS

FlexCMS Support Forum


ARTICLES FORMATS
Started November 4, 2006 @ 2:31pm by cberks
Post Message 
cberks


Posts: 63
 
ARTICLES FORMATSNovember 4, 2006 @ 2:31pm
In which file is the code that interprets the {FlexCMS-Articles|1|0,5|} to format the articles - I would like to add some additional alternatives.

Also, where is the code for the input form to define the {FlexCMS-Articles|1|0,5|}

Regards, Chris
 
DCSun
Administrator



Posts: 625
 
November 4, 2006 @ 3:30pm
Chris,

The code for processing that is located in the index.php file. Search for "na-articles" and that should bring you to it.

I'm not sure what you're asking with your other question.


David


FlexCMS v3.2 Has Been Released!
 
h


Posts: 17
 
error in placing articles in pagesJuly 24, 2008 @ 4:05pm
I would like to use the add articles to a page feature in a custom block. I added the provided code from the article manager into my custom block:
{FlexCMS-Articles|1|0,5|}

I enabled the functions and then received the error about unexpected ","

I also set this same code into the index page to test it out, but rec'd the following error:
Parse error: syntax error, unexpected T_STRING in /data/home/vfcweb/websites/vfcboard.vancouverfood.coop/docs/index.php(1736) : eval()'d code on line 1

this is a dmeo site and will go live when i can get these glitches ironed out! any help is really appreciated.
 
DCSun
Administrator



Posts: 625
 
July 24, 2008 @ 4:20pm
The code you got from the Add Articles To Page form should work fine in a page, but it does not work in blocks. To use it in a page, simply paste that in wherever you'd like them to appear. Make sure PHP is not enabled on the section you've added that to, it sounds like that may have been the cause of your errors.

To add them to a block, you can cheat and use the code from FlexCMS directly in your block:

Code

if ($IM['na'] == 'y') {

$query_na = "select * from `".$Settings['DBPrefix']."na-Settings`";
$result_na = mysql_query($query_na) or die (mysql_error());
while ($row_na = mysql_fetch_array($result_na)) {
$naSettings[$row_na['Name']] = $row_na['Value'];
}

function AddArticles2($StyleCode,$ArticlesCount,$CategoriesList) {
Global $Settings, $MainURL, $ImagesURL, $naSettings, $FontFace, $FontSize, $MsgText;

$ArticlesCode = '';
$ArticlesPrinted = 0;


if ($StyleCode == 1 || $StyleCode == 2 || $StyleCode == 3 || $StyleCode == 4) {
$ArticlesCode = '<table width="100%" border="0" cellpadding="3" cellspacing="0">';
}


if (strpos($ArticlesCount,',') !== false) {
list($ACOffset,$ACCount) = explode(',',$ArticlesCount);
$LimitString = intval($ACOffset).','.intval($ACCount);
}
else {
$LimitString = intval($ArticlesCount);
}

if ($CategoriesList != '') {

$CategoriesArray = explode(',',$CategoriesList);
for ($i = 0; $i < count($CategoriesArray); $i++) {
$CategoriesArray[$i] = intval($CategoriesArray[$i]);
}
$CategoriesList2 = implode(',',$CategoriesArray);

$query_na = "SELECT * FROM `".$Settings['DBPrefix']."na-Articles` WHERE ApprovedBy!='' AND (Category IN (".$CategoriesList2.") OR Category2 IN (".$CategoriesList2.") OR Category3 IN (".$CategoriesList2.") OR Category4 IN (".$CategoriesList2.") OR Category5 IN (".$CategoriesList2.")) ORDER BY DateCode DESC LIMIT ".$LimitString;
}
else {
$query_na = "SELECT * FROM `".$Settings['DBPrefix']."na-Articles` WHERE ApprovedBy!='' ORDER BY DateCode DESC LIMIT ".$LimitString;
}
$result_na = mysql_query($query_na) or die (mysql_error());
while ($row_na = mysql_fetch_array($result_na)) {

if ($StyleCode == 1) {

if ($ArticlesPrinted > 0) {
$ArticlesCode .= '<tr><td colspan="2"><img src="'.$ImagesURL.'/spacer.gif" width="1" height="1" alt="" border="0"></td></tr>';
}


if ($row_na['Teaser'] == '') {
$StrippedArticle = strip_tags($row_na['Article']);

if (strlen($StrippedArticle) > $naSettings['TeaserLength']) {
$TeaserSection = substr($StrippedArticle,0,$naSettings['TeaserLength']);
while (substr($TeaserSection,strlen($TeaserSection)-1,1) != ' ') {
$TeaserSection = substr($TeaserSection,0,strlen($TeaserSection)-1);
}
while (substr($TeaserSection,strlen($TeaserSection)-1,1) == ' ') {
$TeaserSection = substr($TeaserSection,0,strlen($TeaserSection)-1);
}

$TeaserSection .= '... <font size="1">[<a href="'.$MainURL.'/articles/view/'.$row_na['RecordNumber'].'.html">'.$MsgText[7][78].'</a>]</font>';
$row_na['Title'] = '<a href="'.$MainURL.'/articles/view/'.$row_na['RecordNumber'].'.html">'.$row_na['Title'].'</a>';
$ArticleLinked = 'y';
}
else {
$TeaserSection = $row_na['Article'];
}
}
else {
$TeaserSection = substr($row_na['Teaser'],0,$naSettings['TeaserLength']);

if (strlen($row_na['Teaser']) > strlen($TeaserSection)) {
while (substr($TeaserSection,strlen($TeaserSection)-1,1) != ' ') {
$TeaserSection = substr($TeaserSection,0,strlen($TeaserSection)-1);
}
while (substr($TeaserSection,strlen($TeaserSection)-1,1) == ' ') {
$TeaserSection = substr($TeaserSection,0,strlen($TeaserSection)-1);
}
}

$TeaserSection .= '... <font size="1">[<a href="'.$MainURL.'/articles/view/'.$row_na['RecordNumber'].'.html">'.$MsgText[7][78].'</a>]</font>';
$row_na['Title'] = '<a href="'.$MainURL.'/articles/view/'.$row_na['RecordNumber'].'.html">'.$row_na['Title'].'</a>';
$ArticleLinked = 'y';
}




if ($row_na['Image'] != '' && $row_na['ImageType'] > 0) {
$TypeExtensions[1] = '-thumb.gif';
$TypeExtensions[2] = '-thumb.jpg';
$TypeExtensions[3] = '-thumb.png';

if ($ArticleLinked == 'y') {
$PhotoStuff = '<a href="'.$MainURL.'/articles/view/'.$row_na['RecordNumber'].'.html"><img src="'.$ImagesURL.'/articles/'.$row_na['Image'].$TypeExtensions[$row_na['ImageType']].'" alt="" border="0"></a>';
}
else {
$PhotoStuff = '<img src="'.$ImagesURL.'/articles/'.$row_na['Image'].$TypeExtensions[$row_na['ImageType']].'" alt="" border="0">';
}
}
else {
$PhotoStuff = '<img src="'.$ImagesURL.'/spacer.gif" width="1" height="1" alt="" border="0">';
}

$ArticlesPrinted++;
$ArticlesCode .= '<tr><td width="90%"><font face="'.$FontFace.'" size="'.$FontSize.'"><b>'.$row_na['Title'].'</b><br>'.$TeaserSection.'</td><td width="10%" align="center">'.$PhotoStuff.'</td></tr>';
} // end if style 1

else if ($StyleCode == 2) {

if ($ArticlesPrinted > 0) {
$ArticlesCode .= '<tr><td colspan="2"><img src="'.$ImagesURL.'/spacer.gif" width="1" height="1" alt="" border="0"></td></tr>';
}


if ($row_na['Teaser'] == '') {
$StrippedArticle = strip_tags($row_na['Article']);
$TeaserSection = substr($StrippedArticle,0,$naSettings['TeaserLength']);

if (strlen($StrippedArticle) > $naSettings['TeaserLength']) {
while (substr($TeaserSection,strlen($TeaserSection)-1,1) != ' ') {
$TeaserSection = substr($TeaserSection,0,strlen($TeaserSection)-1);
}
while (substr($TeaserSection,strlen($TeaserSection)-1,1) == ' ') {
$TeaserSection = substr($TeaserSection,0,strlen($TeaserSection)-1);
}

$TeaserSection .= '... <font size="1">[<a href="'.$MainURL.'/articles/view/'.$row_na['RecordNumber'].'.html">'.$MsgText[7][78].'</a>]</font>';
$row_na['Title'] = '<a href="'.$MainURL.'/articles/view/'.$row_na['RecordNumber'].'.html">'.$row_na['Title'].'</a>';
$ArticleLinked = 'y';
}
}
else {
$TeaserSection = substr($row_na['Teaser'],0,$naSettings['TeaserLength']);

if (strlen($row_na['Teaser']) > strlen($TeaserSection)) {
while (substr($TeaserSection,strlen($TeaserSection)-1,1) != ' ') {
$TeaserSection = substr($TeaserSection,0,strlen($TeaserSection)-1);
}
while (substr($TeaserSection,strlen($TeaserSection)-1,1) == ' ') {
$TeaserSection = substr($TeaserSection,0,strlen($TeaserSection)-1);
}
}

$TeaserSection .= '... <font size="1">[<a href="'.$MainURL.'/articles/view/'.$row_na['RecordNumber'].'.html">'.$MsgText[7][78].'</a>]</font>';
$row_na['Title'] = '<a href="'.$MainURL.'/articles/view/'.$row_na['RecordNumber'].'.html">'.$row_na['Title'].'</a>';
$ArticleLinked = 'y';
}




if ($row_na['Image'] != '' && $row_na['ImageType'] > 0) {
$TypeExtensions[1] = '-thumb.gif';
$TypeExtensions[2] = '-thumb.jpg';
$TypeExtensions[3] = '-thumb.png';

if ($ArticleLinked == 'y') {
$PhotoStuff = '<a href="'.$MainURL.'/articles/view/'.$row_na['RecordNumber'].'.html"><img src="'.$ImagesURL.'/articles/'.$row_na['Image'].$TypeExtensions[$row_na['ImageType']].'" alt="" border="0"></a>';
}
else {
$PhotoStuff = '<img src="'.$ImagesURL.'/articles/'.$row_na['Image'].$TypeExtensions[$row_na['ImageType']].'" alt="" border="0">';
}
}
else {
$PhotoStuff = '<img src="'.$ImagesURL.'/spacer.gif" width="1" height="1" alt="" border="0">';
}

$ArticlesPrinted++;
$ArticlesCode .= '<tr><td width="10%" align="center">'.$PhotoStuff.'</td><td width="90%"><font face="'.$FontFace.'" size="'.$FontSize.'"><b>'.$row_na['Title'].'</b><br>'.$TeaserSection.'</td></tr>';
} // end if style 2

else if ($StyleCode == 3) {

if ($ArticlesPrinted > 0) {
$ArticlesCode .= '<tr><td colspan="2"><img src="'.$ImagesURL.'/spacer.gif" width="1" height="1" alt="" border="0"></td></tr>';
}


if ($row_na['Teaser'] == '') {
$StrippedArticle = strip_tags($row_na['Article']);
$TeaserSection = substr($StrippedArticle,0,$naSettings['TeaserLength']);

if (strlen($StrippedArticle) > $naSettings['TeaserLength']) {
while (substr($TeaserSection,strlen($TeaserSection)-1,1) != ' ') {
$TeaserSection = substr($TeaserSection,0,strlen($TeaserSection)-1);
}
while (substr($TeaserSection,strlen($TeaserSection)-1,1) == ' ') {
$TeaserSection = substr($TeaserSection,0,strlen($TeaserSection)-1);
}

$TeaserSection .= '... <font size="1">[<a href="'.$MainURL.'/articles/view/'.$row_na['RecordNumber'].'.html">'.$MsgText[7][78].'</a>]</font>';
$row_na['Title'] = '<a href="'.$MainURL.'/articles/view/'.$row_na['RecordNumber'].'.html">'.$row_na['Title'].'</a>';
$ArticleLinked = 'y';
}
}
else {
$TeaserSection = substr($row_na['Teaser'],0,$naSettings['TeaserLength']);

if (strlen($row_na['Teaser']) > strlen($TeaserSection)) {
while (substr($TeaserSection,strlen($TeaserSection)-1,1) != ' ') {
$TeaserSection = substr($TeaserSection,0,strlen($TeaserSection)-1);
}
while (substr($TeaserSection,strlen($TeaserSection)-1,1) == ' ') {
$TeaserSection = substr($TeaserSection,0,strlen($TeaserSection)-1);
}
}

$TeaserSection .= '... <font size="1">[<a href="'.$MainURL.'/articles/view/'.$row_na['RecordNumber'].'.html">'.$MsgText[7][78].'</a>]</font>';
$row_na['Title'] = '<a href="'.$MainURL.'/articles/view/'.$row_na['RecordNumber'].'.html">'.$row_na['Title'].'</a>';
$ArticleLinked = 'y';
}




if ($row_na['Image'] != '' && $row_na['ImageType'] > 0) {
$TypeExtensions[1] = '.gif';
$TypeExtensions[2] = '.jpg';
$TypeExtensions[3] = '.png';

if ($ArticleLinked == 'y') {
$PhotoStuff = '<a href="'.$MainURL.'/articles/view/'.$row_na['RecordNumber'].'.html"><img src="'.$ImagesURL.'/articles/'.$row_na['Image'].$TypeExtensions[$row_na['ImageType']].'" alt="" border="0"></a>';
}
else {
$PhotoStuff = '<img src="'.$ImagesURL.'/articles/'.$row_na['Image'].$TypeExtensions[$row_na['ImageType']].'" alt="" border="0">';
}
}
else {
$PhotoStuff = '<img src="'.$ImagesURL.'/spacer.gif" width="1" height="1" alt="" border="0">';
}

$ArticlesPrinted++;
$ArticlesCode .= '<tr><td width="90%" valign="top"><font face="'.$FontFace.'" size="'.$FontSize.'"><b>'.$row_na['Title'].'</b><br>'.$TeaserSection.'</td><td width="10%" align="center">'.$PhotoStuff.'</td></tr>';
} // end if style 3

else if ($StyleCode == 4) {

if ($ArticlesPrinted > 0) {
$ArticlesCode .= '<tr><td colspan="2"><img src="'.$ImagesURL.'/spacer.gif" width="1" height="1" alt="" border="0"></td></tr>';
}


if ($row_na['Teaser'] == '') {
$StrippedArticle = strip_tags($row_na['Article']);
$TeaserSection = substr($StrippedArticle,0,$naSettings['TeaserLength']);

if (strlen($StrippedArticle) > $naSettings['TeaserLength']) {
while (substr($TeaserSection,strlen($TeaserSection)-1,1) != ' ') {
$TeaserSection = substr($TeaserSection,0,strlen($TeaserSection)-1);
}
while (substr($TeaserSection,strlen($TeaserSection)-1,1) == ' ') {
$TeaserSection = substr($TeaserSection,0,strlen($TeaserSection)-1);
}

$TeaserSection .= '... <font size="1">[<a href="'.$MainURL.'/articles/view/'.$row_na['RecordNumber'].'.html">'.$MsgText[7][78].'</a>]</font>';
$row_na['Title'] = '<a href="'.$MainURL.'/articles/view/'.$row_na['RecordNumber'].'.html">'.$row_na['Title'].'</a>';
$ArticleLinked = 'y';
}
}
else {
$TeaserSection = substr($row_na['Teaser'],0,$naSettings['TeaserLength']);

if (strlen($row_na['Teaser']) > strlen($TeaserSection)) {
while (substr($TeaserSection,strlen($TeaserSection)-1,1) != ' ') {
$TeaserSection = substr($TeaserSection,0,strlen($TeaserSection)-1);
}
while (substr($TeaserSection,strlen($TeaserSection)-1,1) == ' ') {
$TeaserSection = substr($TeaserSection,0,strlen($TeaserSection)-1);
}
}

$TeaserSection .= '... <font size="1">[<a href="'.$MainURL.'/articles/view/'.$row_na['RecordNumber'].'.html">'.$MsgText[7][78].'</a>]</font>';
$row_na['Title'] = '<a href="'.$MainURL.'/articles/view/'.$row_na['RecordNumber'].'.html">'.$row_na['Title'].'</a>';
$ArticleLinked = 'y';
}




if ($row_na['Image'] != '' && $row_na['ImageType'] > 0) {
$TypeExtensions[1] = '.gif';
$TypeExtensions[2] = '.jpg';
$TypeExtensions[3] = '.png';

if ($ArticleLinked == 'y') {
$PhotoStuff = '<a href="'.$MainURL.'/articles/view/'.$row_na['RecordNumber'].'.html"><img src="'.$ImagesURL.'/articles/'.$row_na['Image'].$TypeExtensions[$row_na['ImageType']].'" alt="" border="0"></a>';
}
else {
$PhotoStuff = '<img src="'.$ImagesURL.'/articles/'.$row_na['Image'].$TypeExtensions[$row_na['ImageType']].'" alt="" border="0">';
}
}
else {
$PhotoStuff = '<img src="'.$ImagesURL.'/spacer.gif" width="1" height="1" alt="" border="0">';
}

$ArticlesPrinted++;
$ArticlesCode .= '<tr><td width="10%" align="center">'.$PhotoStuff.'</td><td width="90%" valign="top"><font face="'.$FontFace.'" size="'.$FontSize.'"><b>'.$row_na['Title'].'</b><br>'.$TeaserSection.'</td></tr>';
} // end if style 4



} // end while rows loop


if ($StyleCode == 1 || $StyleCode == 2 || $StyleCode == 3 || $StyleCode == 4) {
$ArticlesCode .= '</table>';
}


return $ArticlesCode;
}


print AddArticles2('1','0,3','');



}





Modify this line: "print AddArticles2('1','0,5','');" to match your "{FlexCMS-Articles|1|0,5|}" tag (the three sections at the end)

That would of course be PHP enabled.


David


FlexCMS v3.2 Has Been Released!
 
h


Posts: 17
 
articles solutionJuly 24, 2008 @ 4:27pm
yep, php enable was source of problem for page insert.

thanks for the how to on the block ...and now i know to "steal code" when needed.

cannot thank you enough. 1 virtual chocolate cake for you!
 

Post Message 




Try & Buy FeedForAll - Easy to use RSS Feed Creator - great for iTunes users!

MEMBERS




All Contents, Code, Scripts and Technologies Copyright 2003-2009 FlexCMS.
All Rights Reserved. Software License Agreement

Processing Time: 0.14155 seconds.
 
Management Login

Powered By FlexCMS
Powered By FlexCMS