Ik heb een website waar ik onlangs een addon aan heb toegevoegd.
Sinsdien is mijn site echter een blank page geworden.
Op men error utlity tool zie ik dat het om een T_CLASS probleem gaat, maar omdat ik bijna niets afweet van php vind ik het niet.

de error melding is de volgende:
[18-Aug-2009 01:14:01] PHP Parse error: syntax error, unexpected T_CLASS in /home/a8033afr/public_html/includes/classes/zentagcloud.php on line 10

zentagcloud.php file:

*/

class wordCloud
{
var $gtags = array(); // tags array

/*
* PHP 5 Constructor
*
* @param array $words
* @return void
*/

function __construct($newtags = false)
{
if ($newtags !== false && is_array($newtags))
{
foreach ($newtags as $key => $value)
{
$this->addTag($value[0],$value[1],$value[2]);
}
}
}


dit is de php van de pagina (zetagcloud.php)
Ervoor staat een hoop uitleg in het groen maar ik vermoed dat dat niet meetelt zeker.








Je class wordt niet afgesloten. tenminste als dit alle code is.


<?php

	class wordCloud
	{
		var $gtags = array(); // tags array
	
	/*
	* PHP 5 Constructor
	*
	* @param array $words
	* @return void
	*/
	
		function __construct($newtags = false)
		{
			if ($newtags !== false && is_array($newtags))
			{
				foreach ($newtags as $key => $value)
				{
					$this->addTag($value[0],$value[1],$value[2]);
				}
			}
		}
	}

?>
@Mark, ik mag hopen dat lieven maar een deel van zijn class hier heeft neer gezet. Lijkt me onwaarschijnlijk dat deze error wordt neergegooid als je een 'curly brace' bent vergeten op het eind, aangezien je dan een totaal andere error krijgt.
Dit is de hele pagina

<?php
/*
@ZenWordCloud
Author:
- Nathan Keilar (www.madteckhead.com)

Version 0.1;

The is the project page for the ZenTagCloud. Its in development right now, its open source and I'd love input / contributions.

Note: the current version is not recommended for live online stores (where you have something to loose), however by all means try it out on you test site, have a look at the code and give me feedback.

p.s. Don't hold me responsible if something breaks.

What is a Tag Cloud?

A tag cloud (or weighted list in visual design) can be used as a visual depiction of content tags used on a website. Often, more frequently used tags are depicted in a larger font or otherwise emphasized, while the displayed order is generally alphabetical. Thus both finding a tag by alphabet and by popularity is possible. Selecting a single tag within a tag cloud will generally lead to a collection of items that are associated with that tag.

Features:
2/June/07: Displays category titles with random weights
3/June/07: Tags links to you Zen Cart site category pages.

Install:

1. Copy the code from this file to one of the Defined Pages using: Tools > Defined Pages Editor.

2. Ensure that the Defined Pages module is enables under: Tools > Layout Box Controller

3. Visit your site, and go to the defined page you pasted the code into. You should see a list of your sites categorie, with random sizes assigned to each one.

Todo/Wishlist:
- Save weights to database
- Add code to ?category's page? so that visits to category's changes weights
- Incorporate some noise in the category's weights to enable new category's a fair chance.
- Option to read tags from meta data
- Option to weight tags my relevance to current tag. (If you like a, you might like b type of thing)

With some code from:
- Derek Harvey (www.derekharvey.co.uk)
- Zen Cart Team (www.zen-cart.com)


Security Note: I've copied and modified a zen cart function to retrieve data from the db, and I think that by leaving the function embeded with the code if may pose some security risk. I'm open to advice on where to put it for best security practice.

*/

class wordCloud
{
var $gtags = array(); // tags array

/*
* PHP 5 Constructor
*
* @param array $words
* @return void
*/

function __construct($newtags = false)
{
if ($newtags !== false && is_array($newtags))
{
foreach ($newtags as $key => $value)
{
$this->addTag($value[0],$value[1],$value[2]);
}
}
}

/*
* PHP 4 Constructor
*
* @param array $words
* @return void
*/

function wordCloud($newtags = false)
{
$this->__construct($newtags);
}

/*
* Assign word to array
*
* @param
* @return
*/
function addTag($count, $url, $tag)
{
if (!$count > 0)
$count = 0;
$utag = strtoupper($tag);
if (!$this->gtags[$utag])
$this->gtags[$utag] = array('count' => $count, 'url' => $url, 'tag' => $tag);
$this->gtags[$utag]['count']++;
}

/*
* Get the class range using a percentage
*
* @returns int $class
*/

function getClassFromPercent($percent)
{
if ($percent >= 99)
$class = 1;
else if ($percent >= 70)
$class = 2;
else if ($percent >= 60)
$class = 3;
else if ($percent >= 50)
$class = 4;
else if ($percent >= 40)
$class = 5;
else if ($percent >= 30)
$class = 6;
else if ($percent >= 20)
$class = 7;
else if ($percent >= 10)
$class = 8;
else if ($percent >= 5)
$class = 9;
else
$class = 0;

return $class;
}

/*
* Create the HTML code for each word and apply font size.
*
* @returns string $spans
*/

function showCloud($returnType = "html")
{
$max = 0;
if (is_array($this->gtags))
{
foreach ($this->gtags as $key => $value)
{
if ($value['count'] > $max)
{
$max = $value['count'];
}
}
}
if (is_array($this->gtags))
{
$return = ($returnType == "html" ? "" : ($returnType == "array" ? array() : ""));
foreach ($this->gtags as $key => $value)
{
$sizeRange = $this->getClassFromPercent(($value['count'] / $max) * 100);
if ($returnType == "html")
{
$return .= '<a class="category-top" href="' . $value['url'] . '">';
$return .= "<span class='word size{$sizeRange}'> &nbsp; {$value['tag']} &nbsp; </span></a>";
}
}
return $return;
}
}
}
?>
Begrijp niet waarom hem dat op regel 10 plaatst??

Gelieve Niet Bumpen:

Twee of meer keer achter elkaar in een topic posten heet bumpen. Bumpen is pas na 24 uur toegestaan en kan een reden zijn voor de admins en moderators om een topic te sluiten. Gebruik indien nodig de knop om je tekst aan te passen.

SanThe.
Niet bumpen...

Google geeft ook niet echt veel nuttige informatie, maar sommigen zeggen dat het probleem was opgelost toen ze een enter achter de PHP open-tag hadden neergezet. En misschien is het probleem opgelost als je even het commentaar verwijdert.
ja dat was idd de oplossing bedankt

Reageren