473,406 Members | 2,220 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Split and divide a string searching a bbcode

I need to divide in two string an article, to split in more pages:

I have this string:
[page]
<hello word>
[/page]

[page]
<hello word2>
[/page]
I need to split in array to show my article in more pages.
I want an array that show already indexed for every page, so I use
foreach and get and show the page.

How the best and speed method to make this?

www.pierpaoloromanelli.com

Mar 17 '07 #1
2 1989
On 17 Mar, 20:22, "progra...@gmail.com" <progra...@gmail.comwrote:
I need to divide in two string an article, to split in more pages:

I have this string:
[page]
<hello word>
[/page]

[page]
<hello word2>
[/page]

I need to split in array to show my article in more pages.
I want an array that show already indexed for every page, so I use
foreach and get and show the page.

How the best and speed method to make this?

www.pierpaoloromanelli.com
Thanks I solved in this method:
if($data['Article']['paged']==true)
{
if (isset($_GET['pag']))
$pagenumber=($_GET['pag']);
else
$pagenumber=1;

$Pieces= explode("[newpage]", $data['Article']['body']);
$data['Article']['pagine']=count($Pieces);
$data['Article']['body']=$Pieces[$pagenumber-1];
}

Mar 17 '07 #2
pr*******@gmail.com wrote:
I have this string:
[page]
<hello word>
[/page]

[page]
<hello word2>
[/page]
I do something similar, but use <!--@PAGE@--to mark page boundaries.

On what page is the line I've marked with an asterisk?

[page]
<hello word>
[/page]
*
[page]
<hello word2>
[/page]

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
Mar 19 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Vamsi | last post by:
Hi, I am trying a basic opearation of splitting a multiline value to an array of single lines(Actually making Address into AddressLine1, AddressLine2). I used Environment.NewLine in split, I...
1
by: 如履薄冰 | last post by:
BBcode reference: http://www.phpbb.com/phpBB/faq.php?mode=bbcode I want write a BBcode module in Python, but I'v not idea for this. Who can tell me about this arithmetic? ( I'm so sorry for my...
3
by: ashok | last post by:
Hi, I need a function that will divide text from mysql in 2 parts, so that I can display first half in one column and second half in second column. I can't find what function will do this job....
7
by: Jordi Rico | last post by:
Hi, I know I can split a string into an array doing this: Dim s As String()=Regex.Split("One-Two-Three","-") So I would have: s(0)="One" s(1)="Two"
24
by: garyusenet | last post by:
I'm working on a data file and can't find any common delimmiters in the file to indicate the end of one row of data and the start of the next. Rows are not on individual lines but run accross...
2
by: veerapureddy | last post by:
Hi friends, i need some urgent help from u. i would like to divide a string using a "\"(pathseparator) as delimeter with Split method. String str="c:\documents\csr\text.txt i need the...
2
Markus
by: Markus | last post by:
I was intruiged as to how to build a parse that would run like bbcode does. So's i had a go at it, somewhat shakily and naively. As was expected, i hit a snare: when searching for a i could...
8
by: raaman rai | last post by:
i am adding dynamic contents in my website. So i also want to have a news or announcements to be dynamically displayed. But for this i need to use BBCode. But in reference to this, i dont know how...
2
by: bgold12 | last post by:
I already posted this message, but it didn't work or something. So if this is a duplicate, ignore it. I just can't figure out how to install this extension. From what I understand, there needs...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.