WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Pages in Flash (2 posts)

  1. sophistikat
    Member
    Posted 7 years ago #

    Hello.

    I am developing my own theme and I am stuck right now. I want to pass the page information to my flash movie.

    I have: (menu.php)

    <?php
    
    	$link = mysql_connect("localhost", "root", "root");
    	mysql_select_db("whiteboardiaries");
    
    	$query = 'SELECT * FROM wp_posts WHERE post_type="page"';
    	$results = mysql_query($query);
    
    	echo "<?xml version=\"1.0\"?>\n";
    	echo "<menu>\n";
    
    	echo "\t<page>\n";
    	echo "\t\t<item>";
    	bloginfo("name") ;
    	echo "</item>\n";
    	echo "\t\t<url>";
    	bloginfo("url");
    	echo "</url>\n";
    	echo "\t</page>\n";
    
    	while ($page = mysql_fetch_assoc($results))
    	{
    		echo "\t<page>\n";
    		echo "\t\t<item>" . $page["post_title"] . "</item>\n";
    		echo "\t\t<url>" . $page["guid"] . "</url>\n";
    		echo "\t</page>\n";
    	}
    
    	echo "</menu>\n";
    
    	mysql_close($link);
    ?>

    When I test my site, using <?php include (TEMPLATEPATH . '/menu.php') ?> it outputs `<?xml version="1.0"?>
    <menu>
    <page>
    <item>Whiteboard Diaries</item>

    <url>http://localhost:8888/empirical.com/whiteboarddiaries</url>
    </page>
    <page>
    <item>About Me</item>
    <url>http://localhost:8888/empirical.com/whiteboarddiaries/?page_id=4</url>
    </page>
    <page>

    <item>Portfolio</item>
    <url>http://localhost:8888/empirical.com/whiteboarddiaries/?page_id=5</url>
    </page>
    <page>
    <item>Contact Me</item>
    <url>http://localhost:8888/empirical.com/whiteboarddiaries/?page_id=6</url>
    </page>

    </menu>` onto the page... which is correct!

    BUT

    When I embed my flash movie, I can't seem to pass the xml output properly?!!

    I have tried:

    <script type="text/javascript">
    		// <![CDATA[
    		var so = new SWFObject("http://localhost:8888/empirical.com/whiteboarddiaries/wp-content/themes/whiteboard/swf/pages.swf", "flashMenu", "100%", "45", "6", "#000000");
    		so.addVariable('xml_location', <?= include (TEMPLATEPATH . '/menu.php') ?>);
    		so.write("flashMenu");
    		// ]]>
    	</script>

    and

    <script type="text/javascript">
    		// <![CDATA[
    		var so = new SWFObject("http://localhost:8888/empirical.com/whiteboarddiaries/wp-content/themes/whiteboard/swf/pages.swf", "flashMenu", "100%", "45", "6", "#000000");
    		so.addVariable('xml_location', 'http://localhost:8888/empirical.com/whiteboarddiaries/wp-content/themes/whiteboard/menu.php');
    		so.write("flashMenu");
    		// ]]>
    	</script>

    NOW

    pass the entire location seems right but the php is not being executed and it looks like flash is reading the content of the PHP script and not the output of the PHP script.

    Any thoughts?
    Did I lose you?

  2. sophistikat
    Member
    Posted 7 years ago #

    I figured this out. The bloginfo() function's output did not work with what i wanted so i simply queried the wp_options table to get the blog name and url.


    # add to tag: blog title
    $name_query = 'SELECT option_name, option_value FROM wp_options WHERE option_name="blogname"';
    $name_results = mysql_query($name_query);
    while($name_row = mysql_fetch_assoc($name_results))
    {
    echo "\t\t<item>" . $name_row['option_value'] . "</item>\n";
    }

    # add to tag: blog url
    $url_query = 'SELECT option_name, option_value FROM wp_options WHERE option_name="siteurl"';
    $url_results = mysql_query($url_query);
    while($url_row = mysql_fetch_assoc($url_results))
    {
    echo "\t\t<url>" . $url_row['option_value'] . "</item>\n";
    }

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.