Ravens PHP Scripts: Forums


View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating Modules
Author Message

Joined: Jun 09, 2007
Posts: 172

PostPosted: Sat Sep 22, 2012 12:05 am Reply with quote

Again I am sorry to continue to try and get something done, so I have been told some info that keeps this from happening, but I have a hard time when someone says it cannot be done.

Here we go again, my question is about the gcalander module.
I hear it could be converted for the module to work but with the rules of a block and not the rules of a module.

I was told because alot of the modules use routines of the core program. Looking throught the code it seems that there is a couple of files that seem to have this
if (!defined('MODULE_FILE')) {

   die('You can\'t access this file directly...');


it seems to call the mainfile.php file, but looking through alot of the other .php files that all seem to be making calls to other files inside the gcalander folder. I am guessing that the mainfile.php has limited use but keeps it with the rules of a module and I am not sure how much would need to change to have it run as a block instead of a mod.

I am not asking anyone to do this, but would anyone have a link that may help me understand or to research this more then I could have a clearer understanding.

If someone want to do this as a project or something, I dont want to stop you either Smile

thank you for any info
View user's profile Send private message

Joined: Aug 26, 2012
Posts: 60

PostPosted: Sat Sep 22, 2012 2:27 am Reply with quote

what sort of block are you wanting?
View user's profile Send private message
Site Admin

Joined: Jun 04, 2004
Posts: 6412

PostPosted: Sat Sep 22, 2012 7:45 am Reply with quote

Mainfile contains core functions that are used in most scripts, including blocks. It should not be necessary to include (or require) mainfile in a module or block as it should already be included by the index.php or modules.php script, and it's functions will be available to the block. To clarify, require or include don't "call" anything, they simply make the code / functions in mainfile available to be used in the current script.

There are existing gCalendar blocks that could be used as a reference, if there isn't one that already provides what you desire.

I google, therefore I exist...
nukeSEO - nukeFEED - nukePIE - nukeSPAM - nukeWYSIWYG
View user's profile Send private message

PostPosted: Sat Sep 22, 2012 6:24 pm Reply with quote

The other gcalendar blocks that I have seen are just a picutre that you can click on to open in a new home page.
andyb2: I want to convert the gcalender as a block so i can run it as a center block on the home page. If i create a block to just load the module then it still has the rule of one module on the home page.

so if i only wanted to run the gcalender to show on home then it comes up fine, but if i want to run another module and the gcalendar then it will not show because of the module rule. This means that the only way i could get the 2 to show on the home page is to convert it as a full fledge block or to find the way to change the rule of one module only.

PostPosted: Sun Sep 23, 2012 5:46 am Reply with quote

I think a lot of the issue (here and on the other thread) are due to being lost in translation, along the way. It happens- both when English is your native language, AND isn't! (So 2 English speaking people can have issues also!)


Is what you are after something that looks like this?
Image ?

So instead of the centre block (as it is now), it shows more detail within the block itself like above? (I'll call it a block for now)

PostPosted: Sun Sep 23, 2012 7:59 am Reply with quote

yes something like this, but i want it as a center block on the home.

If you also noticed before you seen the other post you saw this one an posted. you then noticed the other one.
Please realize that i have noticed that over the years one post would hardly draw attenion and a second one that is worded just a little differently gets a responce and progress is made.
this does look like another calendar that I have worked with, and if you would like to share I would be intrested in what you used.
Thank you for taking the time to help instead of telling me it cannot be done.

PostPosted: Sun Sep 23, 2012 12:21 pm Reply with quote

I'm guessing it can be done; this is actually a screenshot of something available for wordpress that I've used on another site;

I did try various quick "hacks" on the existing calendar centre block, but it didn't work. I'm no programmer, but it's down to the wording, I guess (we have similar issues on my own site regarding technical help for some cars)

Basically, as I understand it now, you want a centre block for the calendar to look similar to how it does when you go straight to the calendar module..., but be available on your home page and still use something like "news" to be your default.. (If I understand correctly, hence my "lost in translation" part Very Happy )

I'm no coder, but I can read code and understand roughly what it does (so if it's a "simple" error, I can usually fix it myself, or have a go at trying to)

What I tried so far was using the existing centre block, replacing some of the code lower in that and replacing with a lot of the code in the module. The problem will be, I think, that you will possibly have "limited" functionality in the block, and it will still need to go through to the full calendar module. (I think)- unless it's a full on web 2.0 type thing- way, way over my head.....

You can't even pull it in as an iframe into a block, because the module pulls in the rest of the site (header, footer, blocks, etc.)

I also looked into an alternative that you may not have thought of (but it would detract from the site)- and that's to see if you could use google calendar instead.
You may wonder why, but experience with another word press plug in gives you all that above, but also the ability for people not registered with the site to add it to their own calendars and then show maps, etc.

Not easy to explain- only thing I can give as an example is on a site I work on for a relative (their design, etc.- I just built it) - [ Only registered users can see links on this board! Get registered or login! ]

if you hover over an event, then click the link to an event, you will see what I mean.

I feel like I'm waffling now, but that's a good example of "bundling in" additional functionality that may not have been thought of previously.

Something like that for *nuke* would not be easy, and is a LONG WAY beyond my capabilities.

Back to my original suggestion, as per the screenshot though, does that make more sense, and more what you are after? I'll keep playing with the code (when I can)- but it may need input from the more experienced on the site than myself.
But understanding the requirements is a start Very Happy

PostPosted: Sun Sep 23, 2012 1:27 pm Reply with quote

thank you for your help, but the more i think about it the more I really want to work on the gcalendar. I am just trying to setup something that members of our church has asked. For many years I have learned not to always take everything at face value, I question even answers I have learned because i have found it helps. I may try and fail and I am sure someone will say they told me so, and thats fine, but at least i tried.
so if you look at the gcalendar module and you come up with any ideas or if you find any site that has some good info to do what I am trying I would be greatfull.
there is alot of great talent here, and I dont mean to abuse any of it by asking in so many different methods. I understand that most of you have alot going on already and this is not a must have for your work.
I do thank those that are helping and trying to give some direction to steps that could help me be sucessfull in my task

thank you

the site i am working on right now is not linked to the church main url, but i can say if not for the help from this site and others I would never made it this far.
Former Moderator in Good Standing

Joined: Aug 30, 2005
Posts: 3312
Location: near Albany NY

PostPosted: Sun Sep 23, 2012 2:09 pm Reply with quote

Take a look at http://webmhcc.org

It's a bicycle club website I run. I have Gcalendar as my module in home and I supplement it with several other blocks, such as the recent articles block, several feeds blocks and several message blocks. You just have to use the blocks editor to arrange things but you can put center blocks above and below the Gcalendar module presentation in home.

I know it's not exactly what you are asking for, but with a little imagination you might be able to use these techniques meet your needs.
View user's profile Send private message Visit poster's website

PostPosted: Sun Sep 23, 2012 5:35 pm Reply with quote

wow, that site has Alot of information Smile
In how you have it set you use the calendar as a module on the home and the blocks to link to news and information. It gives more of the look I would like but I am far from having enough information to make it look very good. I would have a calendar and a bunch of blocks with 1 or 2 things in them. And the other hard part is that I dont use many of the blocks already :/ we havnt even used forums for 6 years and this is the first time i am trying to incorperate the forums as read only...
thank you for the insight on additional options that I can work with if I cannot get the other done...

PostPosted: Sun Sep 23, 2012 5:40 pm Reply with quote

You might want to take a look at "administering blocks" in the RNwiki.


And feel free to post back with any questions. You only need to use the blocks that you want to use; there is no need to have as many open as I do. In fact, I am likely to reduce the number open on my home page because of comments from users that there's too much there and it's hard to follow.

PostPosted: Sun Sep 23, 2012 8:43 pm Reply with quote

Ok, I was reading this, and to make sure i had read this a few times because of the idea's and questions that started bombarding my thoughts.

You can put pretty much any html code, including tables and images into these blocks.

would this mean that you could pull information from a database and post what you want in a block?
If it can then there should be a method to setup a block to just pull the tables and info from a database to show in a block without having the limit of just one module on the home page? And this would still allow you to use the original program for the administration and additional database entries?
to set this you would have to have the database info to make the calls of the data and the tables that are stored?
this way you wouldnt have to try and convert a module to a block.
Or would pulling info from a database that is used for a module then pass the rule of being a module to the block?

thank you for the additional info, it really gives me more to think about.

PostPosted: Mon Sep 24, 2012 12:37 am Reply with quote

well I wanted to say that I have found someone that answered a post on another site and they have converted it to work as a block and after testing I can say its about 95% complete. Just a small thing i found and it will be fully working and I will share who did it and share the steps they told me to get it working. I guess persistance pays off Smile

PostPosted: Mon Sep 24, 2012 2:37 pm Reply with quote

This is a fix that I seems to work, and the nice thing about this is you dont have to really do that much. I was able to get this fix from Noto over at clanthemes.com

In your GCalendar folder open viewmonth.php
global $module_name; 

require_once 'modules/' . $module_name . '/gcal.inc.php';
require_once 'modules/' . $module_name . '/class.combo.php';
require_once 'modules/' . $module_name . '/common.inc.php';
require_once 'modules/' . $module_name . '/getMonthlyEvents.php';
require_once 'modules/' . $module_name . '/displayCatLegend.php';
require_once 'modules/' . $module_name . '/formatEvents.php';

Replace with
// global $module_name; 

// require_once 'modules/' . $module_name . '/gcal.inc.php';
// require_once 'modules/' . $module_name . '/class.combo.php';
// require_once 'modules/' . $module_name . '/common.inc.php';
// require_once 'modules/' . $module_name . '/getMonthlyEvents.php';
// require_once 'modules/' . $module_name . '/displayCatLegend.php';
// require_once 'modules/' . $module_name . '/formatEvents.php';

// Noto mod
$CalPath = 'GCalendar';
require_once 'modules/' . $CalPath . '/gcal.inc.php';
require_once 'modules/' . $CalPath . '/class.combo.php';
require_once 'modules/' . $CalPath . '/common.inc.php';
require_once 'modules/' . $CalPath . '/getMonthlyEvents.php';
require_once 'modules/' . $CalPath . '/displayCatLegend.php';
require_once 'modules/' . $CalPath . '/formatEvents.php';

create a block file block-GCalendar_Module.php or whatever you want to name it and put this information in there.

// Noto mod

if ( !defined('BLOCK_FILE') ) {
   Header('Location: ../index.php');


$CalPath = 'GCalendar';

require_once 'modules/' . $CalPath . '/language.php';

require_once 'modules/' . $CalPath . '/viewmonth.php';
require_once 'modules/' . $CalPath . '/printable.php';

$y = isset($y) ? $y : 0;
$m = isset($m) ? $m : 0;
viewMonth($y, $m, $printable);

$output = ob_get_contents();
$content = $output;

$content .= '<script type="text/javascript" src="modules/' . $CalPath . '/displayCatLegend.js"></script>';


they said the only problem was width and this was resolved by making the todays date two lines instead of one.
echo '<td align="left" valign="middle" width="31%"><span class="thick">' . _HEADER_TODAYS_DATE . '</span> ' . $gotoToday . "</td>\n";

Replace with
echo '<td align="left" valign="middle" width="31%"><span class="thick">' . _HEADER_TODAYS_DATE . '</span><br />' . $gotoToday . "</td>\n";

at last they said you might get a conflict if you have the side block or any other block to do with GCalendar active, they didn't feel the need to check.

again I want to thank Noto over at clanthemes.com for this easy fix.

PostPosted: Tue Sep 25, 2012 3:21 pm Reply with quote

excellent. I was looking at this last night (trying to modify code myself- log, slow process)- but I wouldn't have got as far as this..... lol
Do you have a screenshot of it in use?

PostPosted: Tue Sep 25, 2012 7:16 pm Reply with quote

I dont know how long i will have the picture link up but should be long enough for others to see Smile


sorry for the size but I wanted you to see that it was loading with a news module and another block. It does work great and persistance paid off Smile
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating Modules

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
Forums ©