Re: [PHP-DB] HTML tags destory formatting?

2001-07-23 Thread Sandis Jerics

There are two cases possible:

1. Store already HTML-formatted text in db. Then you do nothing
   before sending it to the screen; never use nl2br() here!

2. Store plain text, may be with a simpliest tags like b, i, u,
   ol, ul, li, a, img. Then put it through the nl2br() function
   before outputting to browser.
   It's easy for the editor that will update news on the site. So she
   can, for example, copy text from Word document into the form's
   textarea in natural paragraphs,  in browser it will look the
   same, without need to insert br or p for paragraph formatting.

Just select which one is more suitable for u.

Monday, July 23, 2001, 2:37:15 PM, Geoffrey Makstutis [EMAIL PROTECTED] wrote:

GM Hi,

GM I'm getting a problem when I pull text from a mySQL database. The text is froma 
GM varchar field and contains some HTML tags. New lines are translated to BR, but 
GM when the field is outputted, anything coming after an HTML tag loses its 
formatting 
GM (ie. no line breaks converted to BR).

GM Can anyone suggest a solution?


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Re: Splitting Article Pages

2001-07-12 Thread Sandis Jerics

hello!
exactly esterday i had the same problem ;)
 i did it like this, using wordwrap/explode functions:
...
$CFG_max_page_length = 5000;
...
  if(@mysql_num_rows($rez)  0)
  {
   $text  = nl2br(mysql_result($rez,0,text));
   $text_length = strlen($text);
   if($text_length  $CFG_max_page_length)
   {
$page_count = ceil($text_length/$CFG_max_page_length);
$text = wordwrap($text, $CFG_max_page_length, __SPLIT__, 0);
$text_arr = explode(__SPLIT__,$text);
$p = (!isset($p) || !($p0)) ? 1 : (int)$p;
for ($page=1; $page=$page_count; $page++)
{
 $pages .= ($page != $p) ? a href=$PHP_SELF?a=$ab=$bp=$page$page/a  : 
b$page/b ;
}
$pages = p align=rightb$STR_pages:/bnbsp; $pages/p;
$text = $text_arr[$p-1];
  }

echo 
$pages
p$text/p
$pages;

http://demo.mp.lv/guru/index.php?a=1b=17p=1
its upcoming vortal about psyhology/metaphiscs/health in russian
which i afraid i never complete by the deadline.. :/

Jordan Elver [EMAIL PROTECTED] wrote
 Hi,
 I need to split an article over several pages. I know how to create
 next and
 previous links for database queries. But how can I pull out say, an
 article
 from a database and split the article text over a certain amount of pages
 depending on the article length, so every 500 words and new page is
 created?


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Suggest Table Structure

2001-07-05 Thread Sandis Jerics

Hi!

It's exactly what i'm doing right now - each article may have
many pictures, many authors, belong to many categories(sections),
can be translated in some languages, etc. :)
Sorry, i havent much time to explain your example, just paste mine
here.. Perhaps you'll got the idea!

CREATE TABLE articles (
  id int(11) NOT NULL auto_increment,
  title_lv varchar(255) ,
  title_ru varchar(255) ,
  title_en varchar(255) ,
  refs_lv tinytext ,
  refs_ru tinytext ,
  refs_en tinytext ,
  intro_lv text ,
  intro_ru text ,
  intro_en text ,
  cite_lv text ,
  cite_ru text ,
  cite_en text ,
  text_lv longtext ,
  text_ru longtext ,
  text_en tinytext ,
  author_desc_lv text ,
  author_desc_ru text ,
  author_desc_en text ,
  phone tinytext ,
  fax tinytext ,
  email tinytext ,
  web tinytext ,
  datetime datetime NOT NULL DEFAULT '-00-00 00:00:00' ,
  active int(1) NOT NULL DEFAULT '1' ,
  counter int(11) NOT NULL DEFAULT '0' ,
  PRIMARY KEY (id)
);

CREATE TABLE articles_images (
  id int(11) NOT NULL auto_increment,
  article int(11) NOT NULL DEFAULT '0' ,
  file varchar(255) NOT NULL DEFAULT '' ,
  text_lv tinytext ,
  text_ru tinytext ,
  text_en tinytext ,
  url tinytext ,
  PRIMARY KEY (id),
  UNIQUE file (file)
);

so, the data about images contained in this second table,
which is linked to the main table articles by the article id.

then i join these tables like this:

SELECT
  ...
FROM
  articles, articles_images
WHERE
  articles_images.article = articles.id


Hello kachaloo,

Thursday, July 05, 2001, 12:00:43 PM, you wrote:

k Hi guys,
k I am making a table which will store articles for a site
k and the feilds are :

k ID int(6) NOT NULL auto_increment,
k CATEORY varchar(10) NOT NULL DEFAULT 'EVENTS' ,
k HEADING varchar(30) NOT NULL DEFAULT '' ,
k BODY longblob ,
k PICTURE longblob ,
k KEYWORD varchar(30) NOT NULL DEFAULT '' ,
k FILENAME varchar(50) ,
k FILESIZE varchar(50) ,
k FILETYPE varchar(50) ,
k PRIMARY KEY (ID),
k UNIQUE ID (ID)


k But now I noticed some of the articles will have more than one
k picture... so how do I structure my table ?

k Thanks in advance,
k Vishal


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]