, 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 > Imbedding recent posts and individual news artcles in a page

FlexCMS Support Forum


Imbedding recent posts and individual news artcles in a page
Started August 22, 2006 @ 4:52pm by cberks
Post Message 
cberks


Posts: 63
 
Imbedding recent posts and individual news artcles in a pageAugust 22, 2006 @ 4:52pm
If it is a simple answer could you give some guidance on how to . . .

(a) imbed recent posts to forums in a page which has other material on it

(b) imbed in a page the teaser for an individual article not basing it on most recent by category but basing it on the article id

Regards, Chris
 
DCSun
Administrator



Posts: 625
 
August 22, 2006 @ 8:38pm
Chris,

A) Paste this code in a PHP-enabled page, and that should give you the basics. If you'd like more control you can grab the code from the "inc-mb-recent.php" file along with the top few lines below and go from there.


Code

$query = "select * from `".$Settings['DBPrefix']."mb-Settings`";
$result = mysql_query($query) or die (mysql_error());
while ($row = mysql_fetch_array($result)) {
$mbSettings[$row['Name']] = $row['Value'];
}

include_once('./inc-mb-recent.php');

print $PageContents;



B) I'm not sure exactly what you're wanting to do there, but you can pull whatever you would like from the database by article id using this code ($ArticleID would be the article number):

Code

$query = "select * from `".$Settings['DBPrefix']."na-Articles` where RecordNumber='".$ArticleID."' limit 1";
$result = mysql_query($query) or die (mysql_error());
$row = mysql_fetch_array($result);



David


FlexCMS v3.2 Has Been Released!
 
cberks


Posts: 63
 
RE: including several individual articles in a pageAugust 25, 2006 @ 8:21pm
Perhaps you could direct me to where the code is that I could lift and adapt if necessary to in effect have more than complete article on a single page such as having the results of

index.php/articles/view/8.html
index.php/articles/view/11.html
index.php/articles/view/21.html

on a single page

it would help if you could point me to where the code is that creates (for example)

index.php/articles/view/8.html

ie when one clicks on [read more]

Regards, Chris
 
DCSun
Administrator



Posts: 625
 
August 25, 2006 @ 11:00pm
Chris,

It's essentially the code I pasted in above for part B. For example, to pull the contents of those three articles you would do this:


Code

$query = "select * from `".$Settings['DBPrefix']."na-Articles` where RecordNumber=8 limit 1";
$result = mysql_query($query) or die (mysql_error());
$row = mysql_fetch_array($result);

print $row['Article'].'<br><br>';


$query = "select * from `".$Settings['DBPrefix']."na-Articles` where RecordNumber=11 limit 1";
$result = mysql_query($query) or die (mysql_error());
$row = mysql_fetch_array($result);

print $row['Article'].'<br><br>';


$query = "select * from `".$Settings['DBPrefix']."na-Articles` where RecordNumber=21 limit 1";
$result = mysql_query($query) or die (mysql_error());
$row = mysql_fetch_array($result);

print $row['Article'].'<br><br>';

And then obviously whatever formatting you wanted to apply to it. I just added a couple returns after each one to break it up a bit.

As for the full code that FlexCMS uses to generate the article pages, that's located in the "inc-na-idx.php" file. Lines 38 through 171 generate the full article page. Below that is the emailing functions to allow the sending of an article to someone else (lines 176 through 367), and below that is the listing pages that are generated to list the articles in a particular category.


Hope that helps,

David


FlexCMS v3.2 Has Been Released!
 

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.12671 seconds.
 
Management Login

Powered By FlexCMS
Powered By FlexCMS