Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Title, Description & 1 | 2 | 3 Next

Guest
Apr 15, 2007 Apr 15, 2007

Copy link to clipboard

Copied

Ok, let me explain my message title. I was wanting to know how to go about and create articles where they show a specific amount of text where the reader needs to select either page number or next to advance to the next page.

A perfect example would be the Jerusalem Post. Click here to go to the website and select any headline news. In there you will see that the article is lengthy however at the bottom of the article you can see that there is a next and previous and a page jump whether you want to go to any page.

I have already a database in MySQL that I have as...
articleID
title
desc

How do I replicate something like this website?
Is there a php function where lets say the desc table field counts the number of characters on a page? If so, what is this function called.

How do news websites create their articles as such.
TOPICS
Server side applications

Views

330
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Apr 16, 2007 Apr 16, 2007

Copy link to clipboard

Copied

Hi,

first of all :: please don´t name your table field "desc", because this is a "reserved word" (desc = descending) -- please read more about which terms to avoid in table names here

>>
Is there a php function where lets say the desc table field counts the number of characters on a page?
>>

there are several ways to accomplish this using PHP functions which truncate a given string to a max. value of chars -- this is one possibility:

-----------
function article_preview($string, $max_length){
if (strlen($string) > $max_length) {
$string = substr($string,0,$max_length);
$string .= '...';
}
return $string;
}
------------------------------

this function can be reused like this:

<?php echo article_preview($row_article['description'], 40); ?>

to truncate the article to 40 chars, followed by "..."

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 16, 2007 Apr 16, 2007

Copy link to clipboard

Copied

Thank you so much for your help with the naming tip and code. I am new to the dynamic side of things especially PHP and all these timbits of information is most helpful. I tried your code and it works perfectly. The other question would be where the "..." is incorporated how do incorporate the id of the article lets say I have have a next and previous button, so they can click on next to read more of the article. I hope I am making sense.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Apr 16, 2007 Apr 16, 2007

Copy link to clipboard

Copied

>>
The other question would be where the "..." is incorporated
>>

well, I would use this "truncate text" method only on, say, the Jerusalem Post main page -- when you have a clickable headline and want to display an excerpt of the contents below. When looking at this page, I *think* they decided on a different solution, because the excerpts all have a different length :: they assumingly use an extra field like "description_preview" for defining the article´s summary manually -- much too often the "automatic truncation" won´t produce meaningful stuff ;-)

>>
lets say I have have a next and previous button, so they can click on next to read more of the article
>>

If I were you, I´d actually use two related tables :: one containing the articleID and the title, and another one for storing the "pages" which are related to a certain "articleID" in the first table. This method does have some advantages over your current attempt to store the article contents in the same table :: when storing the articles in a different table, you can assign an arbitrary number of them to, say, articleID 1 (those articles will also share the same title BTW) -- and that´s also a prerequisite for extensions like Tom Muck´s Recordset Navigation Suite, which provides a good variety of "paging" options.

your separate "articles" table should provide at least this structure:

- ID (numeric, primary, auto increment)
- articleID (numeric, for defining an article´s relation to the articleID in the first table)
- article_content (text)

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 16, 2007 Apr 16, 2007

Copy link to clipboard

Copied

You are right. Thank you that is most helpful. About Tom Muck´s Recordset Navigation Suite, I have been thinking about purchasing it but one thing has held me back and that is the same with the Interakt products is that now that Adobe has made Dreamweaver CS3 can these products be used? I do not know about whether to make a investment on the new Dreamweaver CS3 because of the products mentioned above. However, one thing I was thinking about and I do not know if anyone has tried this but can two seperate dreamweavers lets say CS3 and MX 2004 can be installed on the same computer and be used seperately if they are both the full version or upgrade?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Apr 16, 2007 Apr 16, 2007

Copy link to clipboard

Copied

>>
now that Adobe has made Dreamweaver CS3 can these products be used?
>>

MXKollection and also Interakt´s discontinued products will not work on CS3 -- but today the Kollection successor, called "Adobe Dreamweaver Developer Toolbox" has been officially announced on the Adobe website. The Interakt website has now also been updated and provides some info on the included components here. However, a product similar to Tom Muck´s Recordset Navigation Suite is not included here.

>>
can two seperate dreamweavers lets say CS3 and MX 2004 can be installed on the same computer and be used seperately if they are both the full version or upgrade
>>

CS3 and MX 2004 do work side by side -- but any sites based on the "Phakt" server model can´t be edited with CS3, because Phakt has now also been discontinued.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 17, 2007 Apr 17, 2007

Copy link to clipboard

Copied

LATEST
Something else I don't believe anyone covered what headlines to display
and in what order. For that you can expire date and an ordering field.
So your query will call for all records newer than a certain date
(greater than two days ago, for example) and then order them. You
could use the ID for ordering if it is an identity or some other method.

Just my thoughts.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines