Displaying records on Wordpress Blog
10 posts by 3 authors in: Forums > CMS Builder
Last Post: November 14, 2011 (RSS)
By Mel - August 16, 2011
All of my sites are on same server under my control
I am able to disable open_basedir without problem
The code below is what I use on several conventional coded websites not wordpress and all works fine
If I try and use the same code it just shows the code and does not display any record detail
<?php
// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/home/melsview/public_html/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }
// load records
list($biosRecords, $biosMetaData) = getRecords(array(
'tableName' => 'bios',
'allowSearch' => '0',
'where' => 'region = "east anglia"',
));
?>
Do I need to change something or is it the case that you cannot display records from the cms database on a blog?
Thanks - Mel
Re: [mel] Displaying records on Wordpress Blog
By robin - August 16, 2011
Are you trying to display the records by pasting that code into a wordpress article? For security reasons, wordpress wont allow php code to execute. You'll need to pull the records in some other way, maybe in the wordpress template.
Hope that helps,
Robin
Programmer
interactivetools.com
Re: [robin] Displaying records on Wordpress Blog
By Mel - August 17, 2011
Hey Mel,
Are you trying to display the records by pasting that code into a wordpress article? For security reasons, wordpress wont allow php code to execute. You'll need to pull the records in some other way, maybe in the wordpress template.
Hope that helps,
Robin
Hi Robin,
Yes was pasting the code into a page, so what you are suggesting is putting the code directly into the template that wordpress uses to display a specific page?
Mel
Re: [mel] Displaying records on Wordpress Blog
By robin - August 17, 2011
You'll need to put the code anywhere will it will actually execute. That should work directly in the template. Or maybe you can use an iframe.
Hope that helps,
Robin
Programmer
interactivetools.com
Re: [robin] Displaying records on Wordpress Blog
By Mel - November 12, 2011
The following code works in a template but throws up errors
A blank template page .i.e before I drop in database query code, displays without errors
This code is the same code that works without problem on non wordpress sites any ideas how to get rid of the error messages?
Code:
<?php
?>
This is the snarfer2 template with old css taken out
<?php
// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/home/melsview/public_html/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }
// load records
list($biosRecords, $biosMetaData) = getRecords(array(
'tableName' => 'bios',
'where' => 'tw1=1',
));
?>
<div>
<div><h2>Heading</h2></div>
<!-- start of gallery layout -->
<div>
<?php foreach ($biosRecords as $biosRecord): ?><!-- master foreach-->
<div>
<div>
<h2><?php echo $biosRecord['name'] ?> Age: <?php echo $biosRecord['age'] ?></h2>
</div>
<div align="center"><?php foreach ($biosRecord['newimage'] as $upload): ?>
<?php if ($upload['isImage']): ?>
<a href="<?php echo $biosRecord['_link'] ?>" target="_self"><img src="<?php echo get_custom_watermark_url($upload['urlPath'], 'testwater.gif') ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="<?php echo $biosRecord['name'] ?>"></a>
<?php else: ?>
<?php endif ?>
</div>
<?php endforeach ?>
<p align="center"><a href="<?php echo $biosRecord['_link'] ?>" target="_self">Click to view details</a></p>
<!-- end viewme--></div>
<!-- finish master foreach--><?php endforeach ?>
<!-- end regionGallery --></div>
<!-- end of gallery layout -->
<!-- end wrapperMain --></div>
Error Messages:
Strict Standards: Non-static method GA_Filter::widget_content() cannot be called statically in /home/melhud/public_html/wp-includes/plugin.php on line 170 Strict Standards: Non-static method GA_Filter::widget_content() cannot be called statically in /home/melhud/public_html/wp-includes/plugin.php on line 170 Strict Standards: Non-static method GA_Filter::widget_content() cannot be called statically in /home/melhud/public_html/wp-includes/plugin.php on line 170
And These error messages appear at the bottom of the page:
Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /home/melhud/public_html/wp-includes/script-loader.php on line 660
Strict Standards: Creating default object from empty value in /home/melhud/public_html/wp-includes/user.php on line 660
Strict Standards: Creating default object from empty value in /home/melhud/public_html/wp-includes/user.php on line 660
Strict Standards: Creating default object from empty value in /home/melhud/public_html/wp-includes/class-wp-admin-bar.php on line 167
Strict Standards: Only variables should be passed by reference in /home/melhud/public_html/wp-includes/admin-bar.php on line 266
Strict Standards: Creating default object from empty value in /home/melhud/public_html/wp-includes/class-wp-admin-bar.php on line 167
Strict Standards: Creating default object from empty value in /home/melhud/public_html/wp-includes/class-wp-admin-bar.php on line 167
Strict Standards: Creating default object from empty value in /home/melhud/public_html/wp-includes/class-wp-admin-bar.php on line 167
Strict Standards: Creating default object from empty value in /home/melhud/public_html/wp-includes/class-wp-admin-bar.php on line 167
Strict Standards: Creating default object from empty value in /home/melhud/public_html/wp-includes/class-wp-admin-bar.php on line 167
Strict Standards: Creating default object from empty value in /home/melhud/public_html/wp-includes/class-wp-admin-bar.php on line 167
Re: [mel] Displaying records on Wordpress Blog
By Jason - November 14, 2011
All of this warning are coming from files inside the wp-includes folder, which look like wordPress plugins.
It seems that the code in those files don't follow PHP strict standards and your server is set up to report strict standards errors/warnings. You should be able to turn this off with this code up near the top of your page:
error_reporting(E_ALL ^ E_STRICT);
Hope this helps
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Displaying records on Wordpress Blog
By Mel - November 14, 2011
Thanks for your reply
Do you mean that this piece of code should be placed on the template page that I have set up?
Also do I have to put any php command around the text or just put it on the page as it is
Thanks
Mel
Re: [mel] Displaying records on Wordpress Blog
By Jason - November 14, 2011
The code in those files are getting executed, they're just producing warnings, which is what you're seeing on your page.
Try this at the very top of your file:
<?php error_reporting(E_ALL ^ E_STRICT); ?>
Let us know if that takes care of the issue for you.
Hope this helps
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Displaying records on Wordpress Blog
By Mel - November 14, 2011
I have put the line of code in the template that I am using for the page but it has added error messages to the top of the page as well know... along the same lines as the other error messages
Couple of thoughts although I am no expert on this
1. Is there a way of setting up something in an .htaccess file to deal with it it
OR
2. Could I make a connection to the external database using mysql connect database username etc, although I am not sure how I would code this to pull up what it is already displaying, or if it would make any difference
Both sites are on the same server which I have full control of and I can allow other domains to connect to the database through Cpanel
Thanks
Mel
Re: [mel] Displaying records on Wordpress Blog
By Jason - November 14, 2011
The problem seems to be the error reporting level of your server. It shouldn't have anything to do with your database connection. If you want to fill out a [url http://www.interactivetools.com/support]2nd Level Support Request[/url] we can take a quick look at it for you. Although, since the errors seem to be coming from 3rd Party scripts I can't guarantee that this can be handled through support.
Hope this helps
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/