PDA

View Full Version : Admin functions


Ninth Dimension
08-19-2002, 04:25 PM
Hi all, i'm about to start working on the admin functions for my vBstory hack, but I don't know where to start.

OK, that is a lie, I know that I should use
<?php
error_reporting(7);
require("./global.php");
cpheader();

/* .... your script here ... */

cpfooter();
?>
as a basis for the file, but after that I'm stuck.

I think that the admin supports some type of non-template based options, with some special code for input tags, etc... but I don't know what these are.

Can anyone gimme a hand please?

Lionel
08-19-2002, 04:33 PM
I am not a coder myself, but what I see the other guys do is write a function for edit, delete or add and then they edit the admin/index.php with the makeeyesnode do?edit do?add etc...and when you click on them it allows you to write directly in database.

Ninth Dimension
08-19-2002, 04:40 PM
I've just had a look at the code for the admin section of the vBquiz hack, and damn - it looks very confusing :(

I'll have to see if i can pull it apart and see what I can learn from it :)

Lionel
08-19-2002, 04:44 PM
you might want to look at the glossary hack. It is less complexed.

Ninth Dimension
08-19-2002, 05:06 PM
Thank you, i'll have a look.

Ninth Dimension
08-19-2002, 06:27 PM
it took me a while, but I think i'm getting used to this, it's really each once you use all the functions that vB has provided.

what do you think of my form code for adding a story to the database?


// add story
echo "<p><b>vBstory $ver - Add Story</b></p>";

doformheader("vbstory_admin","add");
maketableheader("Add Story - All fields are required.","",1,2);
makeinputcode("Story Title", "title", "");
echo '<tr class="'.getrowbg().'"><td valign=top>';
echo "Genre";
echo "</td><td valign=top>";
// get genre list
echo "<select name='genreid'>";
foreach ($genres_global[title] as $genres_key => $genres_value) {
echo "<option value='$genres_key'>$genres_value</option>";
}
echo "</select>";
echo "</td></tr>";
makeinputcode("Character Name", "name", "");
maketextareacode("Background","info",$description,6,50);
makeinputcode("Display <small>1 for yes. 0 for no.</small>", "display", "1");
makehiddencode("what", "story");
makehiddencode("post", "1");
doformfooter("Add Story");

Lionel
08-19-2002, 06:40 PM
why do you make it only one Character? A story should have more than one Character...

Ninth Dimension
08-19-2002, 06:47 PM
it only has one Character because the idea is that you take on the role of that person in the story.

the stories will be written as if you was telling a story to your grandchildren from a first person perspective, but in a past tense.

For example:
I sat in the park and waited for my friends.
instead of:
He sat in the park and waited for his friends.

The story can have more than one character, but you will only have control of one :)

I hope that makes sense?