Anything similar to PRE tags?

This is a discussion on "Anything similar to PRE tags?" within the Web Page Design section. This forum, and the thread "Anything similar to PRE tags? are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Nov 16th, 2007, 14:33
Emzi's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Manchester
Age: 25
Posts: 148
Thanks: 0
Thanked 0 Times in 0 Posts
Anything similar to PRE tags?

Hey all!

I was wondering if there were any tags similar to PRE tags that let you specify a width and still keep the correct formatting?

I'm in the middle of creating a jobs site and the spaces that were created when posting a job weren't showing up when you viewed the job - so I applied a PRE tag to display the job with the correct spaces BUT obviously with long paragraphs it stretches accross the page and looks awful!

I can't apply a width to it which is annoying - so are there any tags similar that will keep the correct formatting? Or am I going to have to edit the PHP/MySQL stuff (ie. the cause of all my headaches!)

Thanks.

The link if you need it: http://www.dev.enjoyonline.co.uk/ukj...?vacancy_id=13
Reply With Quote

  #2 (permalink)  
Old Nov 16th, 2007, 14:37
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Anything similar to PRE tags?

As far as I know .... no ... there's isn't anything you can do there.

How are you entering this stuff in the DB? What is the type associated with that column? You can use longtext and it will keep the formatting.
Reply With Quote
  #3 (permalink)  
Old Nov 16th, 2007, 14:40
Emzi's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Manchester
Age: 25
Posts: 148
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Anything similar to PRE tags?

The type is set as TEXT but I can see in the database it keeps the correct spacing, it just isn't displaying it on the website.
Reply With Quote
  #4 (permalink)  
Old Nov 16th, 2007, 14:44
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Anything similar to PRE tags?

Hmmm .... maybe you can do a preg_replace for \n to <br> !?
Reply With Quote
  #5 (permalink)  
Old Nov 16th, 2007, 14:47
Emzi's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Manchester
Age: 25
Posts: 148
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Anything similar to PRE tags?

I'm currently trying str_replace like that but it isn't working, so I'll try preg_replace
Reply With Quote
  #6 (permalink)  
Old Nov 16th, 2007, 14:49
Emzi's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Manchester
Age: 25
Posts: 148
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Anything similar to PRE tags?

Hmm, it didn't like preg - not sure if I'm doing it right though (complete beginner at this stuff hehe)
Reply With Quote
  #7 (permalink)  
Old Nov 16th, 2007, 14:50
Emzi's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Manchester
Age: 25
Posts: 148
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Anything similar to PRE tags?

Ohh I got the str_replace to work

Thanks for you help
Reply With Quote
  #8 (permalink)  
Old Nov 16th, 2007, 15:13
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: [SOLVED] Anything similar to PRE tags?

Alright! Well done!
Reply With Quote
  #9 (permalink)  
Old Nov 16th, 2007, 15:22
c010depunkk's Avatar
SuperMember

SuperMember
Join Date: Apr 2007
Location: Willich, Germany
Age: 20
Posts: 593
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to c010depunkk
Re: Anything similar to PRE tags?

nl2br
Reply With Quote
  #10 (permalink)  
Old Nov 16th, 2007, 15:26
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
Re: Anything similar to PRE tags?

correct me if I am wrong, but isnt there a way via css to set a width and height on a pre tag?
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
Reply With Quote
  #11 (permalink)  
Old Nov 16th, 2007, 15:27
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
Re: Anything similar to PRE tags?

.... or maybe use a div set at the right width and a pre inside that.

Or heck, just use a div and set white-space: pre; (is that right syntax?)
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
Reply With Quote
  #12 (permalink)  
Old Nov 16th, 2007, 15:28
Emzi's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Manchester
Age: 25
Posts: 148
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Anything similar to PRE tags?

Quote:
Originally Posted by Rob View Post
correct me if I am wrong, but isnt there a way via css to set a width and height on a pre tag?
I tried that and it didn't work
Reply With Quote
  #13 (permalink)  
Old Nov 16th, 2007, 15:29
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Anything similar to PRE tags?

Quote:
Originally Posted by Rob View Post
correct me if I am wrong, but isnt there a way via css to set a width and height on a pre tag?
Nope
Reply With Quote
  #14 (permalink)  
Old Nov 16th, 2007, 15:29
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Anything similar to PRE tags?

Quote:
Originally Posted by c010depunkk View Post

Yeah ... that function would probably be better ...
Reply With Quote
  #15 (permalink)  
Old Nov 16th, 2007, 15:30
Emzi's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Manchester
Age: 25
Posts: 148
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Anything similar to PRE tags?

Quote:
Originally Posted by Rob View Post
.... or maybe use a div set at the right width and a pre inside that.

Or heck, just use a div and set white-space: pre; (is that right syntax?)
Well the pre was already defined in a set width div anyway, so I knew that wouldn't work.

Hmm... never used the white-space: pre before so not sure if it would've worked - but hey, it's one to remember for future reference
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Title Tags, Meta Tags and SEO - Keyword Density or Keyword Spamming? pctank Search Engine Optimization (SEO) 2 Jul 4th, 2008 11:52
group similar data in a string? ktsirig PHP Forum 1 Apr 26th, 2008 00:33
[SOLVED] Apple.com : How to do similar navigation? Ed Web Page Design 24 Oct 28th, 2007 14:28
Learning PhotoShop (or similar)? Legacy_Staff Scripts and Online Services 20 Dec 8th, 2006 11:20
2 similar input validations on one form bldstr JavaScript Forum 3 Jan 30th, 2006 21:27


All times are GMT. The time now is 23:36.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43