Hi There, this is my first post. I only discovered drupal a few weeks ago (i'm not a web developer type person by any means, I just like to dabble :-) ). Absolutely loving the functionality that drupal provides as well as the massive support it gets from forum users, etc and i'm hoping that I can integrate some other bits and bobs that I played around with into Drupal.

Without delving into my life history of "playing with various web techs and apps", etc I've created some stats from my mailserver (using some bash, txt2html and PHP) and graphed the output using jpgraph. I'm hoping someone can point me in the right direction to try and get that same content into drupal. I've a Drupal site set up for some entirely different things and now want my own site using it :-)

My mess about site is at www.cantle.me (it will redirect to a secure page and prompt to approve the certificate - This is because it's self signed but it is valid). If someone wouldn't mind having a look at the tabs across the top (that's a bit of jquery - more messing) and selecting "Mail Stats" and then clicking "Click to view daily email graphs" you'll see a list of dates...clicking on of those dates will display a graph. That is all done with php code. and the ?date (which you'll see in the URL at the bottom of the browser) is pulled from the name of the statistical data output file generated by the bash script mentioned above.

I don't know of a way to write this type of code directly into drupal (although I don't doubt it's possible). I realise that you can write direct php code into pages but i'm not sure that will give me what I need.

I have also seen a way (using iframes) to "scrape" some site content...so worst case, I think I could do that with the final graph output (although i'd rather not have the old site having to do anything).

If someone could point me in the right direction i'd be grateful. Also, as per most Noobs, I apologise if this has been answered a zillion times before. I did do a search but didn't find anything that was what I was looking for.

Thanks a lot

Paul

Comments

cantlep’s picture

I've sorted out the stats now. Still working on the graphs.

I dscovered that I couldn't just move my php scripts to the new part of the filesystem with the website lives. I had to write (well copy and paste) directly into Drupal to get them to work. Is this what I need to do with any existing bits of code? Is there a way to import such files so save me copying and pasting everything directly into Drupal?

Cheers

dman’s picture

http://drupal.org/node/32963
The consensus here is still generally good advice.
either include_once() - which is fine, fast, but limited
or learn to love making a simple module. Everyone does it. see the examples

Best is to do BOTH. Make a drupal module that's nothing more than a wrapper include your existing routines, using hook_menu().

gotcha - DON'T use globals at a file-level context, they won't work. http://drupal.org/node/150276#comment-240287
Neither will local relative path 'include()', use drupal_get_path() or module_load_include() to insert your own libraries. Function references are at api.drupal.org

cantlep’s picture

Thanks for your reply, Dan. I'll take a look.

Cheers