[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2180
  • Last Modified:

Wordpress PHP Datagrid Component

Hello,

I have a datagrid that I am trying to integrate with WordPress with little success.
I have downloaded it from http://phpgrid.wordpress.com/ and have the full paid version.

The problem I have is that when I create a template for WordPress and use it on my homepage I can see the datagrid with the data filled in (see attached working), when I use the same template on another page there is no data in the datagrid (see attached not working)

If i change the permalinks to default it works on all pages but when the permalinks are set to Post name then it only works on the homepage.

I have included the jqgrid_dist.php with its full path, i dont see any errors on the page to suggest it is not seeing the included script, if I change the include location to one I know is not there the I do get an error saying unable to locate the file.

Can anyone suggest a way I can get this to work with the permalinks set to Post name.

Please let em know if you need any more info
not-working.png
working.png
0
koop1koop
Asked:
koop1koop
  • 10
  • 6
1 Solution
 
Jason C. LevineNo oneCommented:
If you enable the browser console and reload the page, do you get any errors?

Also, did you call scripts "normally" or did you use wp_enqueue_script() ?
0
 
koop1koopAuthor Commented:
Sorry how do you mean browser console?

I have called it normally (see attached)
mcare-donor-stock.php
0
 
koop1koopAuthor Commented:
The location where it is not working is http://www.multicare.org.uk/test/
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Jason C. LevineNo oneCommented:
I'm on my iPad today, so I can't test it for you until later, but I will test it later.

http://javascript.about.com/od/reference/a/debug.htm

The link above explains how to debug JavaScript using the browser console.
0
 
koop1koopAuthor Commented:
I looked at the browser console but I don't seem to see any error's but then again I don't think I know what I am looking for.
0
 
koop1koopAuthor Commented:
Please can you help me on this, I am a loss on how to proceed
0
 
Jason C. LevineNo oneCommented:
No errors come up in the console and the grid renders.  The data does not populate, so check to see if your connections to the data source are correct?

Also, you are invoking JQuery twice.  Once in the theme and once again in the page template.  That can cause conflicts and kill any functionality with jquery.  You need to use wp_enqueue_script() to make sure you don't cause conflicts:

http://codex.wordpress.org/Function_Reference/wp_enqueue_script
0
 
koop1koopAuthor Commented:
Thanks for taking a look, as I mentioned before the page template works fine if it is set to the home page it is just when it is set to any other page it doesnt work.

The author of the scripts seems to think that it could be a problem could be wordpress not passing parameters in custom permalinks and suggested putting in the htaccess
RewriteRule . /index.php [L,QSA]
in place of
RewriteRule . /index.php [L]

I have tried this and still get the same result

So to wrap up it is not the jquery as it works when set to the home page and its also not the connection script for the same reason.
0
 
Jason C. LevineNo oneCommented:
That's why I mentioned checking the path to the data source.  If it works at root but not a level down. It may bethe script is looking for the data in the wrong place.  I'm just guessing here as all I can see is the rendered code from the front-end link you provided.
0
 
koop1koopAuthor Commented:
but if i change the permalink structure to default it then works on the page I need it to, if you would like access to the site let me know
0
 
Jason C. LevineNo oneCommented:
Because default permalinks are all index.php?p=XXXX so the relative path is always the same.  Custom permalinks screw with that so any relative paths need to be changed to absolute.
0
 
koop1koopAuthor Commented:
I have tried it with absolute path too but I get the same result
0
 
Jason C. LevineNo oneCommented:
I'm stumped then. Since the grid renders on the test link without data I'm almost certain the data call is the problem.  Hopefully that narrows down your search and efforts.
0
 
koop1koopAuthor Commented:
i have been looking at the following type of solutions but i'm not quite sure how I would implement it

http://www.rlmseo.com/blog/passing-get-query-string-parameters-in-wordpress-url/
0
 
koop1koopAuthor Commented:
So this is what had to happen!

// fix for wordpress 3.4+ (auto replace 'page' variable in url]
$url_arr = explode("/",$_SERVER["REQUEST_URI"]);
if (is_numeric($url_arr[count($url_arr)-2]))
$_GET["page"] = $url_arr[count($url_arr)-2];

you can see more about it here
http://www.kombitz.com/2012/06/29/wordpress-3-4-page-variable-in-query-string
0
 
koop1koopAuthor Commented:
Found the problem
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 10
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now