phpDivinglog Wordpress Integration

3rd party extensions (phpDivingLog, dive computer downloader,...)
ianr
Posts: 47
Joined: Thu Sep 17, 2009 11:44

phpDivinglog Wordpress Integration

Post by ianr » Fri Mar 26, 2010 09:10

Me again... :(

In a fit of eagerness I decided to restructure my webspace and start using wordpress rather than blogger.

I have moved my divelog to the directory http://www.stodge.org.uk/divelog and assume the webroot in the config file should now be 'www.stodge.org.uk' with the abs_url_path set to '/divelog'. However when I upload this and go to page 'www.stodge.org.uk/divelog' then all of the data is a mess. Also, the links to other functions are shown at the root directory instead of inside the sub-directory '/divelog'. I have tried multiple iterations of webroot and abs_url_path with no luck.

The weird thing is that the original sub domain 'www.diving.stodge.org.uk' which is now pointing at '/divleog' actually works but I cannot understand why!

Do i need to refresh the initial config file or run some kind of setup to refresh these directory locations? Am I missing something fundamental?

Sorry that I keep bothering you :oops:

Thanks

Inferno
Posts: 252
Joined: Thu Apr 19, 2007 20:36
Location: The Netherlands
Contact:

Re: phpDivinglog 2.2 development

Post by Inferno » Fri Mar 26, 2010 09:36

Ok now your path is changed:
Something like this

Code: Select all

$_config['web_root']        = 'http://rob.lensen.nu/divelog';

$_config['abs_url_path']    = '/divelog';

If you are integrating with wordpress you should set

Code: Select all

$_config['embed_mode'] = true;
You can make it look like the example of my homepage http://rob.lensen.nu/divelog
You should have a good look at header.php

Code: Select all

require_once('/usr/local/www/rob.lensen.nu/www/wp-blog-header.php');
require_once( ABSPATH . WPINC . '/registration-functions.php');
change the first path

Next the html thing:

Code: Select all

<body>
<div id="rap"> <!--div rap starts-->
<div id="masthead"> <!--div masthead starts-->
<h1 id="header"><a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a></h1>
<div class="slogan"><?php bloginfo('description'); ?></div>
</div> <!--div masthead ends-->
<div id="hmenu"> <!--div hmenu starts-->
<div id="hnav"> <!--div hnav starts-->

<?php include (TEMPLATEPATH . '/horizontal.php'); ?>

</div> <!--div hnav ends-->
</div> <!--div hmenu ends-->
<div id="main"> <!--div main starts-->

<div id="content"> <!--div content starts-->
<div class="post">
This all comes from my template which I use for wordpress. Have a look in the file page.php (most of the times) and copy the top part

ianr
Posts: 47
Joined: Thu Sep 17, 2009 11:44

Re: phpDivinglog 2.2 development

Post by ianr » Fri Mar 26, 2010 12:50

Wow, that is awesome. I'll have a play with the code and will let you know if I struggle.

Thanks again

ianr
Posts: 47
Joined: Thu Sep 17, 2009 11:44

Re: phpDivinglog 2.2 development

Post by ianr » Sat Mar 27, 2010 01:02

Okay, I'm struggling a little with the final stage of integrating this to wordpress. I now have the divelog working when I correct the URLs and put '$_config['embed_mode'] = false;'

However, once I change this to 'true' to embed it I then get stuck. I'm not sure which portion of the HTML block that you included should be put into page.php of my template files and where abouts within this file it should be inserted.

Any more clues?

am I supposed to change the line <?php include (TEMPLATEPATH . '/horizontal.php'); ?> to match my template?

I get the following errors on the page in wordpress

Warning: main(/homepages/23/d168663142/htdocs/wp-content/themes/arjuna-x/horizontal.php) [function.main]: failed to open stream: No such file or directory in /homepages/23/d168663142/htdocs/wp-content/themes/arjuna-x/page.php on line 13

Warning: main() [function.include]: Failed opening '/homepages/23/d168663142/htdocs/wp-content/themes/arjuna-x/horizontal.php' for inclusion (include_path='.:/usr/lib/php') in /homepages/23/d168663142/htdocs/wp-content/themes/arjuna-x/page.php on line 13

ianr
Posts: 47
Joined: Thu Sep 17, 2009 11:44

Re: phpDivinglog 2.2 development

Post by ianr » Tue Apr 06, 2010 01:39

Inferno wrote: If you are integrating with wordpress you should set

Code: Select all

$_config['embed_mode'] = true;
You can make it look like the example of my homepage http://rob.lensen.nu/divelog
You should have a good look at header.php

Code: Select all

require_once('/usr/local/www/rob.lensen.nu/www/wp-blog-header.php');
require_once( ABSPATH . WPINC . '/registration-functions.php');
change the first path

Next the html thing:

Code: Select all

<body>
<div id="rap"> <!--div rap starts-->
<div id="masthead"> <!--div masthead starts-->
<h1 id="header"><a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a></h1>
<div class="slogan"><?php bloginfo('description'); ?></div>
</div> <!--div masthead ends-->
<div id="hmenu"> <!--div hmenu starts-->
<div id="hnav"> <!--div hnav starts-->

<?php include (TEMPLATEPATH . '/horizontal.php'); ?>

</div> <!--div hnav ends-->
</div> <!--div hmenu ends-->
<div id="main"> <!--div main starts-->

<div id="content"> <!--div content starts-->
<div class="post">
This all comes from my template which I use for wordpress. Have a look in the file page.php (most of the times) and copy the top part
I really can't seem to get this to work. If I put the code shown above in the page.php of my template then it complains that /horizontal.php doesn't exist. If I then remove the reference to this then nothing happens and I can't see how this would then point to the dive log.

Help :)

Inferno
Posts: 252
Joined: Thu Apr 19, 2007 20:36
Location: The Netherlands
Contact:

Re: phpDivinglog 2.2 development

Post by Inferno » Tue Apr 06, 2010 08:23

ianr wrote:
I really can't seem to get this to work. If I put the code shown above in the page.php of my template then it complains that /horizontal.php doesn't exist. If I then remove the reference to this then nothing happens and I can't see how this would then point to the dive log.

Help :)
Send the contents of your wordpress dir and a mysql dump and I will have a look. If you don't understand php then there is no way at the moment to embed phpDivinglog in Wordpress. Since it will need some coding in your wordpress theme.

Inferno
Posts: 252
Joined: Thu Apr 19, 2007 20:36
Location: The Netherlands
Contact:

Re: phpDivinglog 2.2 development

Post by Inferno » Tue Apr 06, 2010 15:27

Ok some more details on the embeding:

First create a wordpress Page called diving or any other name but make sure that the page slug is set to "divelog" if your phpdivinglog is located in www.test.com/divelog so the phpdivinglog should be on the same level as your wordpress install.

This is a listing for my test wordpress at http://rob.lensen.nu/testwordpress

Code: Select all

drwxr-xr-x   6 www   www   1024 Apr  6 17:07 ./
drwxrwxr-x  28 robl  www   1536 Apr  6 16:46 ../
drwxr-xr-x  13 www   www   1024 Apr  6 17:10 divelog/
-rw-r--r--   1 www   33     397 May 25  2008 index.php
-rw-r--r--   1 www   33   15410 Dec  6  2008 license.txt
-rw-r--r--   1 www   33    7644 Feb 13 20:35 readme.html
drwxr-xr-x   8 www   33    2560 Feb 15 17:52 wp-admin/
-rw-r--r--   1 www   33   40400 Oct 25 11:32 wp-app.php
-rw-r--r--   1 www   33     220 Oct 14  2008 wp-atom.php
-rw-r--r--   1 www   33     274 May 25  2008 wp-blog-header.php
-rw-r--r--   1 www   33    3928 Jan  7 20:38 wp-comments-post.php
-rw-r--r--   1 www   33     238 Oct 14  2008 wp-commentsrss2.php
-rw-r--r--   1 www   33    2616 Dec  8 20:59 wp-config-sample.php
-rw-r--r--   1 www   www   2530 Apr  6 16:49 wp-config.php
drwxr-xr-x   4 www   33     512 Feb 15 17:52 wp-content/
-rw-r--r--   1 www   33    1253 Aug 16  2009 wp-cron.php
-rw-r--r--   1 www   33     220 Oct 14  2008 wp-feed.php
drwxr-xr-x   6 www   33    2048 Feb 15 17:52 wp-includes/
-rw-r--r--   1 www   33    1946 May  5  2009 wp-links-opml.php
-rw-r--r--   1 www   33    2341 May 20  2009 wp-load.php
-rw-r--r--   1 www   33   22721 Dec 14 23:09 wp-login.php
-rw-r--r--   1 www   33    7578 Sep 18  2009 wp-mail.php
-rw-r--r--   1 www   33     487 Apr 20  2009 wp-pass.php
-rw-r--r--   1 www   33     218 Oct 14  2008 wp-rdf.php
-rw-r--r--   1 www   33     316 May 25  2008 wp-register.php
-rw-r--r--   1 www   33     218 Oct 14  2008 wp-rss.php
-rw-r--r--   1 www   33     220 Oct 14  2008 wp-rss2.php
-rw-r--r--   1 www   33   23097 Dec 14 01:38 wp-settings.php
-rw-r--r--   1 www   33    3693 Nov 26 12:29 wp-trackback.php
-rw-r--r--   1 www   33   93445 Dec  1 09:14 xmlrpc.php
You see divelog is in the root of my wordpress install!!

Next in wordpress set the permalinks to: Custom Structure: /%postname%/ so basiclly what we do is we let wordpress think there is a page a www.test.com/divelog but in fact we display our phpdivinglog.

For your theme I changed header.php to:

Code: Select all

<?php
/**
 * Some things that need to be in the header for phpDivinglog
 */

?>

<?php
 /**
  * Embedding for wordpress
  */
require_once('/usr/local/www/rob.lensen.nu/www/testwordpress/wp-blog-header.php');
require_once( ABSPATH . WPINC . '/registration-functions.php');

add_action('wp_head', 'get_divelog_header');

function get_divelog_header(){
    global $t ;
    //, $_config;
    //$t->display('header_meta.tpl');
    //$t->display('header_title.tpl');
    $t->display('header_css.tpl');
    $t->display('header_script.tpl');
}

get_header();
?>
<div class="contentArea">
<div class="post">


<?php
/**
 * End emmbedding for wordpress
 */
?>
and footer.php to

Code: Select all

<?php
/**
 * Footer for wordpress
 */
?>

</div>
</div> <!--div content ends-->

<?php //get_sidebar(); ?>

</div> <!--div main ends-->

<?php get_footer();
/**
 * End of embedding for wordpress
 */

?>
Changed my config.inc.php to this:

Code: Select all

/**
 * change this to your website url
 */
$_config['web_root']        = 'http://rob.lensen.nu/testwordpress/divelog';

/**
 * Your path where divelog is located
 * EXAMPLE: http://www.foo.com/users/j/jo/john
 * abs_url_path = /users/j/jo/john
 * Nothing todo where phpdivinglog is installed on your harddrive!
 */
$_config['abs_url_path']    = '/testwordpress/divelog';

/**
 * Define if we need to embed phpDivinglog
 * @todo make embedding possible
 */
$_config['embed_mode'] = true;
Result see this:
http://rob.lensen.nu/testwordpress/divelog/

ianr
Posts: 47
Joined: Thu Sep 17, 2009 11:44

Re: phpDivinglog 2.2 development

Post by ianr » Tue Apr 06, 2010 22:25

Okay, I've tried this and get the following error:

Code: Select all

Warning: main(/wp-blog-header.php) [function.main]: failed to open stream: No such file or directory in /homepages/23/d168663142/htdocs/divelog/header.php on line 12

Fatal error: main() [function.require]: Failed opening required '/wp-blog-header.php' (include_path='.:/usr/lib/php:/homepages/23/d168663142/htdocs/divelog/pear:/homepages/23/d168663142/htdocs/divelog/include:/homepages/23/d168663142/htdocs/divelog/') in /homepages/23/d168663142/htdocs/divelog/header.php on line 12
I am assuming that I change the line in header.php

Code: Select all

require_once('/usr/local/www/rob.lensen.nu/www/testwordpress/wp-blog-header.php');
to

Code: Select all

require_once('/wp-blog-header.php');
to show the location of header.php in my directory structure (it's at the root).

It feels so close to working having seen your sample site but it remains out of my grasp.

Currently my structure is similar to yours with wp-blog-header.php at the root directory of the site I have setup. I don't think i need the usr/local/stodge.org.uk do I?

I have the divelog at the same level as the wordpress install the same as you.

I'm pretty sure I am just pointing the wp-blog-header.php call at the wrong place but I have no idea where to point it other than the root.

Inferno
Posts: 252
Joined: Thu Apr 19, 2007 20:36
Location: The Netherlands
Contact:

Re: phpDivinglog 2.2 development

Post by Inferno » Tue Apr 06, 2010 22:34

Just one thing:

Your dir is like this:

Code: Select all

/homepages/23/d168663142/htdocs/
So your include path would be:

Code: Select all

require_once('/homepages/23/d168663142/htdocs/wp-blog-header.php');

terrylowe
Posts: 40
Joined: Sun Aug 12, 2007 03:33
Location: Hattiesburg, MS USA
Contact:

Re: phpDivinglog 2.2 development

Post by terrylowe » Wed Apr 07, 2010 00:16

Hang in there Ianr, you will get it soon! Glad to see someone else that gets a bit crazy whenever it does not work right! :?

I used a simple old-fashioned technique to get my dive log to show up in the web page the way I wanted it to show up. I cheated and used frames. I know that it is not the same as using full php code, but it gets my goal accomplished. I know frames are outdated, but I just don't get megatons of traffic to my site.

http://www.terrylowe.com

I can't wait to see what you create once you get it fixed!

Terry

ianr
Posts: 47
Joined: Thu Sep 17, 2009 11:44

Re: phpDivinglog 2.2 development

Post by ianr » Wed Apr 07, 2010 09:34

Inferno wrote:Just one thing:

Your dir is like this:

Code: Select all

/homepages/23/d168663142/htdocs/
So your include path would be:

Code: Select all

require_once('/homepages/23/d168663142/htdocs/wp-blog-header.php');
Hoooray, that seems to have worked. One step closer...

There's no sidebar but to be honest I'm not that worried about that. It would be nice if it was centred in the page instead, but again, small details.

The only issue I have spotted is that when I follow links within the table the page header changes to 'page not found'. This also appears to happen in your dive log and the test site you set up. Any ideas?

Now to try and get the widget working on other pages in the sidebar. Any idea what to put in the link box when activating the widget?

Inferno
Posts: 252
Joined: Thu Apr 19, 2007 20:36
Location: The Netherlands
Contact:

Re: phpDivinglog 2.2 development

Post by Inferno » Wed Apr 07, 2010 09:44

The sidebar I disabled see your footer.php

Code: Select all

<?php //get_sidebar(); ?>
The two slashes mean that this is just a comment. If you remove them the sidebar will be on the page. I removed it, since your template sidebar is to wide!

The page not found is also on my own page. I do not bother about this....maybe I will look into this. You can fix this by setting query string to true in config.inc.php

Code: Select all

/**
 * Some hosts don't support mod_rewrite, so we must have option to use old
 * query strings  like ?id=&user=
 * If query_string = false normal rewrite is used, if set to true query string is used
 */
$_config['query_string'] = true;
For the widget you should enter:
http://www.stodge.org.uk/divelog/divesummary.php

ianr
Posts: 47
Joined: Thu Sep 17, 2009 11:44

Re: phpDivinglog 2.2 development

Post by ianr » Wed Apr 07, 2010 12:49

Thanks for that. I can can adjust the width of my sidebar in the template but it's not that much of an issue really.

I tried to set 'query_string' to true but it had little effect. Again, I'm not that fussed with that.

I'm busy playing with the widget and trying to sort out the CSS. I have no idea what I'm doing really but am trying to track where it gets info from and am changing things to gauge the impact. I can always disable it if I decide I'm not happy with the results.

Any pointers would be appreciated though ;)

divinglog
Site Admin
Posts: 4697
Joined: Sat Feb 08, 2003 21:02
Location: Coburg
Contact:

Re: phpDivinglog Wordpress Integration

Post by divinglog » Wed Apr 07, 2010 17:56

Inferno asked me to split the Wordpress integration into a separate thread, for easier handling.

Inferno
Posts: 252
Joined: Thu Apr 19, 2007 20:36
Location: The Netherlands
Contact:

Re: phpDivinglog 2.2 development

Post by Inferno » Wed Apr 07, 2010 22:20

ianr wrote:Thanks for that. I can can adjust the width of my sidebar in the template but it's not that much of an issue really.

I tried to set 'query_string' to true but it had little effect. Again, I'm not that fussed with that.

I'm busy playing with the widget and trying to sort out the CSS. I have no idea what I'm doing really but am trying to track where it gets info from and am changing things to gauge the impact. I can always disable it if I decide I'm not happy with the results.

Any pointers would be appreciated though ;)
Get a book of css or read the many manuals on the net.... For testing your css use Firefox with the Firebug extension! Read the docs how to use it. If you have specific questions feel free to ask, this is an Open source product so it will never fit all your needs.

Post Reply