- Moderated by:
- Support
-
- rank:
-
Helper
- registered:
- April 2003
- Status:
- offline
- last visit:
- 19.10.06
- Posts:
- 429
Maybe someone can help me with a problem. I want to create a seperate instance(s) of the Ephemerids module. My goal is to seperate events by topic for various pages.
Does anyone know what I would have to change in the original Ephemerid module so that I can have more than one instance? I have a rough idea of where to start and have tried a few times, but have had no success.
Module Folder Name
New Table
Variables, etc, etc
Any help on what to change would be very much appreciated!
Joe Dunn -
- rank:
-
Helper
- registered:
- April 2003
- Status:
- offline
- last visit:
- 19.10.06
- Posts:
- 429
Here is what I have tried so far:
1. I duplicated the nuke_ephem table and renamed it nuke_ephem_bd
2. I appended each field in the new table with _bd. Such as pneid_bd, pndid_bd, etc.
3. I copied the original NS-Ephemerids to a new folder named NS-Ephemerids_bd
4. I initialized and activated the 'new' ephemerids_bd module. There were no errors to this point.
5. When I went to my Admin menu and clicked on the icon for Ephemerids_bd I received the following error:
error : admin_execute(modules/NS-Ephemerids_bd/admin.php,Ephemerids_bd_admin_main)
I am sure there are many more things that need to be changed but I do not know enough to figure my problem out. Is there anyone in this community that has already multiple instances of the Ephemerids module running or has the knowledge to figure out my next step?
I would really appreciate your help!
Joe Dunn -
- rank:
-
Professional
- registered:
- September 2003
- Status:
- offline
- last visit:
- 11.04.08
- Posts:
- 3055
I haven't tried it myself, but how about this:
Use just the default ephermerids module, and do some kind of parsing on the ephermerids description to determine what topic it belongs to. For example, when entering the description, on the first line enter "topicid=3", then hit enter and enter the rest of the ephermerid...
Then, do some parsing on the description in the ephermerids block: While it is looping through the fetched results - before it does any output - do a string explode or some other manipulation to retreive the text before the 1st linebreak (the "topicid=3"). Then fetch the current topic (or module or whatever - refer to the pnAPI) to see if the ephermerids block should output it... (Do additional explode or string function to retreive the "3" (or whatever value) for comparison). If the value's match, it'll output add the epherm to the block output, if not it gets dumped. If no "topicid" line is found (like maybe you want a "global" epherm) it will output it... Would mostly just take structured way of entering the epherms (id-you-want-to-match=x and then a line break) and some parsing in the epherm block...
P.S. On a semi-related topic, see this post about not displaying the epherm block if there's no epherms for that day!
--
Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods
Cape Cod Travel Info... -
- rank:
-
Helper
- registered:
- April 2003
- Status:
- offline
- last visit:
- 19.10.06
- Posts:
- 429
That seems a lot more complicated than I had hoped. I was looking for a solution more along the lines of this post:
http://forums.postnu…c&t=5838&highlight=
I just can't figure out what all needs to be changed since the modules is a core module it comes setup with the tables already installed. Any other ideas? -
- rank:
-
Professional
- registered:
- September 2003
- Status:
- offline
- last visit:
- 11.04.08
- Posts:
- 3055
I think what I propose is *much* easier than what's in that post... You don't even have to modify the Epherm module, just the block that displays them...
It's really just a matter of using PHP string functions, like explode or substring or whatever on the $content of the block...
For example, if you wanted to do a "topic specific" ephermerid (for topics pages, not for articles pages)
You could enter something like:
Code
topic=1
The Yankees win the World Series
In the content of the epherm. Then in the epherm block (includes/blocks/), where the while loop cycles through to output the day's epherm to a block, replace with:
Code
while(list($yid, $content) = $result->fields) {
$result->MoveNext();
// Break the epherm content at the newline char
$compare_string = explode("\n",$content);
// Break the first line at the equals char
$topic = explode("=",$compare_string[0]);
// Get the topic ID entered in the story
$tid = intval($topic[1]);
// Skip the output if a topic id was assigned and not equal to the one on the page we are on...
if ($tid && $tid != pnVarCleanFromInput('topic')) {
continue;
} else {
$content = $compare_string[1];
}
$boxstuff .= '<br /><br />';
$boxstuff .= '<b>'.pnVarPrepForDisplay($yid).'</b><br />'.pnVarPrepHTMLDisplay(nl2br($content)).'';
}
That's just a simple example and has some problems, like it can't get the topic id from the input on an article page (though you should be able to figure a way to do that yourself), it might have a prob with multiple line breaks, etc.. etc...
--
Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods
Cape Cod Travel Info... -
- rank:
-
Helper
- registered:
- April 2003
- Status:
- offline
- last visit:
- 19.10.06
- Posts:
- 429
I don't "PHP" yet. I am trying to learn but am not comfortable with it. I will try your suggestion and see what I can do. I hope it is as easy as you make it sound. Thank you for your assistance.
Joe Dunn -
- rank:
-
Professional
- registered:
- September 2003
- Status:
- offline
- last visit:
- 11.04.08
- Posts:
- 3055
No it is not possible to run multiple instances of the same module, unless you basically make a whole new module out of it with a different name, add new tables for it, etc... etc...
The solution outlined above would be *much* easier...
--
Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods
Cape Cod Travel Info... -
- rank:
-
Professional
- registered:
- September 2003
- Status:
- offline
- last visit:
- 11.04.08
- Posts:
- 3055
Reread the 5th post above. I think I was pretty thorough - which part don't you understand, exactly?
--
Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods
Cape Cod Travel Info...
