flash parameters

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
llax
Forum Newbie
Posts: 1
Joined: Tue May 03, 2005 7:20 am

flash parameters

Post by llax »

Hi ,

I m now working on mos (mambo open source) and i try to get pathway nav as parameters
for flash integration....

here is my stuff-> an include php which calls swf files if condition non empty;

Code: Select all

<?php 

function showFlashpath( $Itemid ) {
	global $database, $option, $task, $mainframe, $mosConfig_absolute_path, $mosConfig_live_site;
	global $SERVER_SOFTWARE, $QUERY_STRING, $REQUEST_URI;

	// get the home page
	$database->setQuery( "SELECT *"
	. "\nFROM #__menu"
	. "\nWHERE menutype='mainmenu' AND published='1'"
	. "\nORDER BY parent, ordering LIMIT 1"
	);
	$home_menu = new mosMenu( $database );
	$database->loadObject( $home_menu );

	// the the whole menu array and index the array by the id
	$database->setQuery( "SELECT id, name, link, parent, type"
	. "\nFROM #__menu"
	. "\nWHERE published='1'"
	. "\nORDER BY parent, ordering"
	);
	$mitems = $database->loadObjectList( 'id' );

	$isWin = (substr(PHP_OS, 0, 3) == 'WIN');
	$optionstring = $isWin ? $QUERY_STRING : $REQUEST_URI;

	// are we at the home page or not
	$homekeys = array_keys( $mitems );
	$home = @$mitems[$home_menu->id]->name;
	$path = "";

	// this is a patch job for the frontpage items! aje
	if ($Itemid == $home_menu->id) {
		switch ($option) {
			case 'content':
			$id = intval( mosGetParam( $_REQUEST, 'id', 0 ) );
			if ($task=='blogsection'){

				$database->setQuery( "SELECT title FROM #__sections WHERE id=$id" );
			} else if ( $task=='blogcategory' ) {
				$database->setQuery( "SELECT title FROM #__categories WHERE id=$id" );
			} else {
				$database->setQuery( "SELECT title, catid FROM #__content WHERE id=$id" );
			}

			$row = null;
			$database->loadObject( $row );

			$id = max( array_keys( $mitems ) ) + 1;

			// add the content item
			$mitem2 = pathwayMakeLink(
			$Itemid,
			$row->title,
			"",
			1
			);
			$mitems[$id] = $mitem2;
			$Itemid = $id;

			$home = '<a href="'. sefRelToAbs('index.php') .'" class="pathway">'. $home .'</a>';
			break;

		}
	}

	switch( @$mitems[$Itemid]->type ) {
		case 'content_section':
		$id = intval( mosGetParam( $_REQUEST, 'id', 0 ) );

		switch ($task) {
			case 'category':
			if ($id) {
				$database->setQuery( "SELECT title FROM #__categories WHERE id=$id" );
				$title = $database->loadResult();

				$id = max( array_keys( $mitems ) ) + 1;
				$mitem = pathwayMakeLink(
				$id,
				$title,
				'index.php?option='. $option .'&task='. $task .'&id='. $id .'&Itemid='. $Itemid,
				$Itemid
				);
				$mitems[$id] = $mitem;
				$Itemid = $id;
			}
			break;

			case 'view':
			if ($id) {
				// load the content item name and category
				$database->setQuery( "SELECT title, catid, id FROM #__content WHERE id=$id" );
				$row = null;
				$database->loadObject( $row );

				// load and add the category
				$database->setQuery( "SELECT c.title AS title, s.id AS sectionid "
				."FROM #__categories AS c "
				."LEFT JOIN #__sections AS s "
				."ON c.section=s.id "
				."WHERE c.id=$row->catid" );
				$result = $database->loadObjectList();

				$title = $result[0]->title;
				$sectionid = $result[0]->sectionid;

				$id = max( array_keys( $mitems ) ) + 1;
				$mitem1 = pathwayMakeLink(
				$Itemid,
				$title,
				'index.php?option='. $option .'&task=category&sectionid='. $sectionid .'&id='. $row->catid,
				$Itemid
				);
				$mitems[$id] = $mitem1;

				// add the final content item
				$id++;
				$mitem2 = pathwayMakeLink(
				$Itemid,
				$row->title,
				"",
				$id-1
				);
				$mitems[$id] = $mitem2;
				$Itemid = $id;

			}
			break;
		}
		break;

		case 'content_category':
		$id = intval( mosGetParam( $_REQUEST, 'id', 0 ) );

		switch ($task) {

			case 'view':
			if ($id) {
				// load the content item name and category
				$database->setQuery( "SELECT title, catid FROM #__content WHERE id=$id" );
				$row = null;
				$database->loadObject( $row );

				$id = max( array_keys( $mitems ) ) + 1;
				// add the final content item
				$mitem2 = pathwayMakeLink(
				$Itemid,
				$row->title,
				"",
				$Itemid
				);
				$mitems[$id] = $mitem2;
				$Itemid = $id;

			}
			break;
		}
		break;

		case 'content_blog_category':
		case 'content_blog_section':
		switch ($task) {
			case 'view':
			$id = intval( mosGetParam( $_REQUEST, 'id', 0 ) );

			if ($id) {
				// load the content item name and category
				$database->setQuery( "SELECT title, catid FROM #__content WHERE id=$id" );
				$row = null;
				$database->loadObject( $row );

				$id = max( array_keys( $mitems ) ) + 1;
				$mitem2 = pathwayMakeLink(
				$Itemid,
				$row->title,
				"",
				$Itemid
				);
				$mitems[$id] = $mitem2;
				$Itemid = $id;

			}
			break;
		}
		break;
	}

	$i = count( $mitems );
	$mid = $Itemid;

	$imgPath =  'templates/' . $mainframe->getTemplate() . '/images/arrow.png';
	if (file_exists( "$mosConfig_absolute_path/$imgPath" )){
		$img = '<img src="' . $mosConfig_live_site . '/' . $imgPath . '" border="0" alt="arrow" />';
	} else { 
		$imgPath = '/images/M_images/arrow.png';
		if (file_exists( $mosConfig_absolute_path . $imgPath )){
			$img = '<img src="' . $mosConfig_live_site . '/images/M_images/arrow.png" alt="arrow" />';
		} else {
		    $img = '>';
		}
	}

	while ($i--) {
		if (!$mid || empty( $mitems[$mid] ) || $mid == 1 || !eregi("option", $optionstring)) {
			break;
		}
		$item =& $mitems[$mid];

		// converts & to & for xtml compliance
		$itemname = ampReplace( $item->name );
	}
}


if ($Itemid) { ?>

						<object width="50" height="320" align="middle">
						<param name="movie" value="flash/titre.swf" />
						<param name="quality" value="high" />
						<param name="bgcolor" value="#ffffff" />
						
						<embed 
						src="flash/titre.swf" 
						
						FlashVars="txt=<?=$row->title; ?>" 
						
						quality="high" 
						bgcolor="#ffffff" 
						width="50" 
						height="320" 
						name="titre" />
						</object>
		
						<object width="680" height="20" align="middle">
						<param name="movie" value="flash/soustitre.swf" />
						<param name="quality" value="high" />
						<param name="bgcolor" value="#ffffff" />
						
						<embed 
						src="flash/soustitre.swf" 
						
						FlashVars="txt=<?=$Itemid; ?>" 
						
						quality="high" 
						bgcolor="#ffffff" 
						width="680" 
						height="20" 
						name="soustitre" />
						</object>
			
<? }  ?>



I just can't take back parameters Itemid and title from my request on db,
i should have made a mistake, but what????

:?:

help please

d11wtq | Please read the sticky about posting code in the forums :-D
Post Reply