Ok – I’m trying to make a multi page article system. I’m looking at several ways to implement it.
GUI Side
1.) Have a page that has a button that say add page that would make a another form element appear.
2.) Figure out how to create a plug in for FCKEditor to add in [page title=””] in to the text box.
[CODE]<html>
<head>
<script type=”text/javascript”>
function newpage()
{
var page=prompt(“Page Name”,”Page “+document.form1.pagenum.value)
if(page!=null && page!=””)
{
document.form1.txtbox.value = document.form1.txtbox.value+”[[Page=” +page+ “]]”;
++document.form1.pagenum.value;
}
}
</script>
</head>
<body>
<form name=”form1″ id=”form1″>
<input type=”button” onclick=”newpage()” value=”Display a prompt box” />
<input type=”hidden” name =”pagenum” id=”pagenum” value=”1″ />
<textarea name=”txtbox” id=”txtbox” /></textarea>
</form>
</body>
</html>
Depending on the how the back will be done – depends on what would tax the server more… Hey I’m trying to do it as efficiently as possible.
Back end:
1.) Have a table with the main stuff of the article then another for the pages of the article.
2.) Have it all in one table with the [page title=””] tags left intact.
I know that on the back end stuff – 1 would be more MySQL intensive and 2 would be more PHP intensive. 1 I would think would be harder to do updates to the pages.
What would you forumners do? Am I thinking that doing the preg_split stuff is more taxing than it really is? How I’m seeing it has I would have to store the whole thing into a variable and if you have 50 page article – that could be quite a bit of memory usage…
[code=php]<?php
$pattern = ‘/[page title=”.*?”]/’;
$content = ‘blah[page title=”monkey”]Blah blah[page title=”doggy”]asdf[page title=”monkey1″]’;
$pages = preg_split($pattern, $content);
echo ‘<pre>’;
print_r($pages);
echo ‘</pre>’;
?>