Errors with APICMS, general PHP errors

Hello,

I am embedding PHP to run a CMS into this page: huge-du.bz/home-test1.php and I keep receiving and error (please reference page). The general idea is to sort the articles from newest to oldest. I achieve this by using the “datum” field to store a date. So far it isn’t working, any help is GREATLY appreciated. Feel free to email me as well, [email protected]. Thanks :slight_smile:

Here is the code I am using:
[php]<?php
include(“apicms.php”);
$apicms = new ApiCmsClient(“http://www.huge-du.bz/apicms/index.php”, “2c7747910c4cec56ed4546be19268405”);
$options = array(“order” => “id DESC”);
$data = $apicms->category(“main”, $options);

$category = $data[‘category’];
$contents = $data[‘contents’];
?>

<?php if (count($contents) > 0) { ?> <?php foreach ($contents as $content): ?>
<?php if ($content->hasImages) { $images = $content->getImages(); $image = $images[0]; echo ''; } ?>

<?php echo $html->link("".date("d.m.Y", strtotime($content->getField("datum"))).": ".$content->name, "/more/".$content->uid, array("escape" => false)); ?>

<?php echo $content->excerpt; ?>

<?php echo $html->link("weiterlesen...", "/more/".$content->uid); ?>

<?php endforeach; ?> <?php } ?>[/php]

Make sure you are pointing to a function that exists.
Make sure that the page has a connection to the function page you are using.

That’s the problem. The function exists, but for some reason it isn’t working. And that directory seems arbitrary. This is the site I got the code from and it runs on here: http://volksschule.ratschendorf.at/main/aktuelles

Check that apicms.php file was included correct.

To test it, Write a new function into apicms.php and have it echo something back.

<?php echo $html->test(); ?>

Then on the function page,

[php]function test(){
$variable = ‘Holiday’;
return $variable;
}[/php]

lothop, it comes up with the: Fatal error: Call to a member function test() on a non-object

Without seeing apicms.php I suggest checking this…

By adding this into ‘test.php’
[php]$html = new html();

class html {

function test(){
$variable = ‘Holiday’;
return $variable;
}

}[/php]

We can now call the function with
[php]<?php
include(‘test.php’);
echo $html->functionname();
?>[/php]

Hope that sheds some more light on the problem for you. Just make sure its pointing in the right direction. It has all the information it needs. And make sure that the function is within the class ‘html’ on apicms.php
Also if your using a handler check for $html = new html();

.

Sponsor our Newsletter | Privacy Policy | Terms of Service