[HELP] fcms installing wrong?

If you've problems with unsupported - non official ;-) - functionalities use this forum please.
Post Reply
Faren
Posts: 3
Joined: Sun 11. Sep 2005, 01:51

[HELP] fcms installing wrong?

Post by Faren »

http://www.onemindent.com/main/flash.swf

Why doesnt it work? Here is a snapshot of all the files located in the phpwcms install (/main):
Image

here is my actionscript:

Code: Select all

// Fcms module v0.3 for phpwcms
// by Fulvio Romanin ("hey! we might do this too! look! the tiny square is moving!") and Luca Malisan ("just SHUT UP and let me code this php file!")
// Much love to VgSlag (www.flash-git.net) and Shiznit/EfNet-flash for their help and inspiration
// Of course MAXIMUM RESPECT to Oliver Georgi for his sublime work and for his astonishing patience.
// this mod is open source, baby, so you know what it means :)

// first and foremost, hi everyone. This is FCMS v0.3, second enhancement
// i have to say sorry for three things: because of the long delay in releasing it,
// because some variable names are in italian, and because i can give very
// limited support. So i'm explaining it here, best i can.
// (of course you can exclude the whole //comments stuff when doing yours! :)

// please remember this fcms needs Adodb (http://php.weblogs.com/adodb#downloads , free)
// and the files article_xml.php and menu_xml.php included in the same dir

// this defines the site's root. It can be like http://www.mysite.com/whatever
// you may not think so, but this helps a WHOLE LOT

radicedelsito = "http://www.onemindent.com/main/";

// this points to the xml file; this command is much related to hamza fawzi's extension;
// might be unnecessary if using fifferent parsers

// the languageId variable NEEDS TO BE CREATED if using multilanguage. Lang names
// must be included into {LANG_NAME}, so it's like {EN}, {DE}. Of course there are
// no pre-given variable names, you can have whatever you want! :)
// and of course, in html fancy, they must be closed with {/EN}..
// of course you have to do first buttons to choose your language with languageId=whatever
// to initialize the language.

menu.updateProp("xmlFileName",radicedelsito+"menu_xml.php"+languageId);

// other xml menu-related function. This makes the component recognize the imported
// file name as good
menu.init();

// the menu. Here functions get parsed. That's where you'll write into your commands,
// where the REAL stuff will happen.

menu.onReleaseItem = function(itemMovieClipRef) {

// here it gets the id number for each section. You just add the commands for each
// level you need. Or you can simplify using functions. Of course here we're 
// talking about MENU LEVELS, not articles. Here's the part you'll have to customize most.
// you can leave the rest more or less unchanged.

sectionid = itemMovieClipRef.data["sectionid"];

	// button #1
	
	if (sectionid == 1) {
		
	// this is where your code that makes things happen inside of flash goes. An example below
	}
	// button "dove siamo"
	if (sectionid == 2) {
		// this code is useless, it serves you as example.
		
		// clearInterval(intID);
		// posizioni(391, 150, 579, 350, 460, 270, 430, 330);
		// preloader.holder.loadMovie("dovesiamo.swf");
	    // articlelinkscontainer_mc._visible=0;
        // chiusure(0, 0, 1);
		
	}
	
// and so on
// this is where articles get seen
	if (itemMovieClipRef.data["sub"] == 0 && sectionid>-1) {
		ld.Load(radicedelsito+"article_xml.php?sectionid="+sectionid);
	}
};

// più e meno are "plus" and "minus" in italian. I used this to flip thru the articles.
// there is an AS article-generated menu. You can use both, or none. :)
// plus and minus will appear just and only if more than one article-per-level will be there.
// even if unnecessary - here we set them invisible

piu._visible = 0;
meno._visible = 0;

// initializing characters
system.useCodepage = true;

// from now on, there are some functions to parse the data correctly. Data is pulled
// out of raw code splitting it with given clues. You can apply it to anything if
// you use the same principle.
// the function parselanguage is necessarily the first one to interpretate the raw data pulled
// up from database. Consider that - if the images to be loaded are in different languages
// you can easily do it from here setting a different image on each {LANG}{/LANG}

function parseLanguage(rawString,languageId)
//explaining function, so you can customize it at pleasure...
{
   var chunks = rawString.split("{"+languageId +"}");	      // breaks the string searching for the beginning (e.g: {it})
   var retVal = "";                                        // prepares the value  
   for ( var i=1;i<chunks.length;i++)                           // for all found values (usually 1)
   {
      var chunks2 = chunks[i].split("{/"+languageId +"}"); // finds its end (e.g: {/it})
      if (chunks2.length > 0)
         retVal += chunks2[0];                             // if found, adds the piece to the result
   }
   return retVal;                                          // returns the result
}

// this searches for <img src inside of the raw data to establish where an image might be;
// same principle as above, as you can see

function findImage(input)
{
	var img = input.split("<IMG");
	if (img.length > 1)
	{
		var src = img[1].split("src=\"");
		if (src.length > 1)
		{
			var srcendindex = src[1].indexOf("\"");
			return src[1].substring(0, srcendindex);
		}
	}
}

// same thing for links

function findLink(input)
{
	var link=input.split("<A");
	if (link.length > 1)
	{
		var href = link[1].split("href=\"");
		if (href.length > 1)
		{
			var hrefendindex = href[1].indexOf("\"");
			return href[1].substring(0, hrefendindex);
		}
	}
}

// this function is somehow redundant but i left it just the same.
// this finds multiple images.

function findImages(input)
{
	var images = new Array;
	var pos = 0;
	while (pos < input.length)
	{
		var img = input.substr(pos).split("<IMG");
		var len = img[0].length;
		if (img.length > 1)
		{
			len += img[1].length;
			var src = img[1].split("src=\"");
			if (src.length > 1)
			{
				var srcendindex = src[1].indexOf("\"");
				images[images.length] = src[1].substring(0, srcendindex);
			}
		}
		pos = pos + len;
	}
	return images;
}

// this is one of the most important functions as it splits articles from the same
// menu level.

function splitArticles(articleList)
{
	var articles = new Array;
	var splittedArticles = articleList.split("||");
	for (i=0;i<splittedArticles.length;i++)
	{
		var splittedArticle = splittedArticles[i].split("$$");
		articles[articles.length] = splittedArticle; 
	}
	return articles;
}

// and finally, the loadvars thingy

ld = new LoadVars();
ld.onLoad = function (success){
	if (success)
	{
		// sets title, summary, text
		title = parseLanguage(this.title,languageId);
		// parses the summary for languages
		summary = parseLanguage(this.summary,languageId);
		// gets images
		images = findImages(this.summary);		
		// verifies if it's necessary showing "plus" and "minus"
		piu.sel = this.next;
		if (this.next > -1)
			piu._visible = 1;
		else
			piu._visible = 0;
		meno.sel = this.prev;
		if (this.prev > -1)
			meno._visible = 1;
		else
			meno._visible = 0;

		// loads the first two images
		mc.loadMovie(images[0]);
		
		// this gives the button the link property
		// (consider it was done for my never-ended fcms portfolio - sigh!)
		_root.link = findLink (this.summary); 
		mc2.loadMovie(images[1]);

		// loads the article list from the section, and creates
		// the article list menu as you can see in "locations" in www.braidadicasa.com
		// the shape and the way the link appears can be modified from within the
		// library inside the articlelinkscontainer_mc mc
		for (i=0;i<articlelinkscontainer_mc.articles.length;i++)
			articlelinkscontainer_mc["articlelink_mc"+i].removeMovieClip();
		articlelinkscontainer_mc.articles = splitArticles(this.articlelist);
		for (i=0;i<articlelinkscontainer_mc.articles.length;i++)
		{ 
			articlelinkscontainer_mc.attachMovie("articlelink_mc","articlelink_mc"+i,i,{_y:articlelinkscontainer_mc._height+(20*i)});
			currentLink = articlelinkscontainer_mc["articlelink_mc"+i];
			currentLink.articlelink_text = articoli+parseLanguage(articlelinkscontainer_mc.articles[i][1],languageId);
			currentLink.articleId = articoli+articlelinkscontainer_mc.articles[i][0];
			currentLink.gotoAndPlay(30-i*3);

			
		}
		
	}
	else
	{
		title = "Error!";
	};
	
	
};

//phew! that's all, folks! ;)
and here is my article_xml (with the db stuff taken out):

Code: Select all

<?
// **** FCMS v0.1 || flash frontend for phpwcms ||****
// code by Luca Malisan (thanks!!), Fulvio Romanin and ***add your name here*** :)
//
// this is meant to be open source. you're supposed know what that means, right? :) <br>
// please don't remove this lines. They're our only reward. :)

include('adodb/adodb.inc.php'); 
require_once ("include/inc_conf/conf.inc.php"); 
 
$db = ADONewConnection("mysql");  
$db->Connect($phpwcms["localhost"] , $phpwcms["babygyrl_wcms1"] , $phpwcms["REMOVED"], $phpwcms[""] ); 
$db->SetFetchMode(ADODB_FETCH_ASSOC); 

function getArticleVariables($articleid = -1)
{
	global $db,$phpwcms;
	$retstr = "";
	if ($articleid >= 0)
	{
		$sql = "SELECT article_id , article_title, article_subtitle, article_summary  FROM ".($phpwcms["db_prepend"]!=""?$phpwcms["db_prepend"]."_":"")."phpwcms_article WHERE article_id = $articleid"; 
		$article = $db->GetAll($sql);
		if(is_array($article) && count($article) > 0)
		{
			$retstr .= "title=".urlencode($article[0]["article_title"]);
			$retstr .= "&subtitle=".urlencode($article[0]["article_subtitle"]);
			$retstr .= "&summary=".urlencode($article[0]["article_summary"]);
		}
	}
	return $retstr;
}
/* Get requested article in requested section, providing links to previous and next article, and a list of all articles in the section */
function getSectionArticles($sectionid = -1)
{
	global $db,$phpwcms;
	$retstr = "";
	if ($sectionid >= 0)
	{
		$sql = "SELECT article_id , article_title, article_subtitle, article_summary  FROM ".($phpwcms["db_prepend"]!=""?$phpwcms["db_prepend"]."_":"")."phpwcms_article WHERE article_cid = $sectionid ORDER BY article_sort"; 
		// get all articles in this section
		$articles = $db->GetAll($sql);
		$selected = $_GET["sel"] > -1 ? $_GET["sel"] : 0;	//if there isn't a selected article, select first article
		if(is_array($articles) && count($articles) > $selected)	// if selected article is valid
		{
			// return title, subtitle, summary
			$retstr .= "title=".urlencode($articles[$selected]["article_title"]);
			$retstr .= "&subtitle=".urlencode($articles[$selected]["article_subtitle"]);
			$retstr .= "&summary=".urlencode($articles[$selected]["article_summary"]);
			
			// if there is a previous article, return its index
			if (is_array($articles[$selected-1]))
				$retstr .= "&prev=".($selected-1);
			else
				$retstr .= "&prev=-1";
			
			// if there is a next article, return its index
			if (is_array($articles[$selected+1]))
				$retstr .= "&next=".($selected+1);			
			else
				$retstr .= "&next=-1";
			
			// return article list as a string where || separes every article and $$ separes article id from article title
			$retstr .= "&articlelist=";
			foreach($articles as $i=>$article)
				$retstr .= $i."$$".urlencode($article["article_title"])."||";
			$retstr = substr($retstr,0,-2);
		}
	}
	return $retstr;
}

if ($_GET["articleid"] != "")
	echo(getArticleVariables($_GET["articleid"])); 
else if($_GET["sectionid"] != "")
	echo(getSectionArticles($_GET["sectionid"])); 
?>
here is the menu_xml:

Code: Select all

<?
// **** FCMS v0.1 || flash frontend for phpwcms ||****
// code by Luca Malisan (thanks!!), Fulvio Romanin, Julian Sander and ***add your name here*** :)
//
// this is meant to be open source. you're supposed know what that means, right? :) <br>
// please don't remove this lines. They're our only reward. :)

include('adodb/adodb.inc.php');
require_once ("include/inc_conf/conf.inc.php");

$db = ADONewConnection("mysql"); 
$db->Connect($phpwcms["localhost"] , $phpwcms["babygyrl_wcms1"] , $phpwcms["REMOVED"], $phpwcms[""] );
$db->SetFetchMode(ADODB_FETCH_ASSOC);

function parseLanguage($rawString,$languageId)
{
   $chunks = explode("{".$languageId."}",$rawString);	      // spezza la stringa cercando gli inizi (p.es: {it})
   $retVal = "";                                        // prepara il valore da tornare  
   for ($i=1;$i<count($chunks);$i++)                           // per tutti i pezzi trovati (di solito 1)
   {
      $chunks2 = explode("{/".$languageId."}",$chunks[$i]); // spezza per cercare la fine (p.es: {/it})
      if (count($chunks2) > 0)
         $retVal .= $chunks2[0];                             // se trovato, aggiunge il pezzo al risultato
   }
   return $retVal;                                          // torna il risultato
}

function drawXmlMenu($struct = 0)
{
	global $db,$phpwcms;
	$retstr = "";
	$sql = "SELECT acat_id, acat_name FROM ".($phpwcms["db_prepend"]!=""?$phpwcms["db_prepend"]."_":"")."phpwcms_articlecat WHERE acat_struct = $struct AND acat_public = 1 AND acat_aktiv = 1 AND acat_trash = 0 ORDER BY acat_sort"; 
	$menu = $db->GetAll($sql);
	echo($db->ErrorMsg());
	if (is_array($menu))
	{
		foreach($menu as $menurow)
		{
			if (isset($_GET["lang"]))
				$retstr .= '<item name="'.htmlentities(parseLanguage($menurow["acat_name"],$_GET["lang"])).'"  sectionid="'.$menurow["acat_id"].'">';
			else
				$retstr .= '<item name="'.htmlentities($menurow["acat_name"]).'"  sectionid="'.$menurow["acat_id"].'">';
			$retstr .= drawXmlMenu($menurow["acat_id"]);
			$retstr .= '</item>';
		}
	}
	return $retstr;
}

?>
<hiermenu method="2"><? echo(drawXmlMenu(0)); ?></hiermenu>

Any ideas? :(
User avatar
Fulvio Romanin
Posts: 394
Joined: Thu 4. Dec 2003, 11:12
Location: Udine, Italy
Contact:

Post by Fulvio Romanin »

please be patient til the end of the week and wait v0.5. that will be explained step by step.... :)

(ehm, no flash file at given link...) :shock:
Completeness is reached through subtraction, not through addition
Faren
Posts: 3
Joined: Sun 11. Sep 2005, 01:51

Post by Faren »

it appears my databases are down. To many connections to them at once. I hate my host :(
Post Reply