bftwofreak Posted September 15, 2008 Share Posted September 15, 2008 For some reason when this code is executed: <?php /* 1st Place */ $tag['1'] = 'threesixohfreak'; $view['1'] = '<div class="tabbertab"><h2>1st: ' . $tag['1'] . '</h2><p></p></div>'; ?> <script type="text/javascript" src="modules/<?php echo $module_name ?>/d/tabber.js"></script> <link rel="stylesheet" href="modules/<?php echo $module_name ?>/d/tabber.css" type="text/css" media="screen" /> <link rel="stylesheet" href="modules/<?php echo $module_name ?>/d/tabber-print.css" type="text/css" media="print" /> <div class="tabber"> <?php echo $view['1'] ?> </div> the output is < Where did I go wrong? Quote Link to comment Share on other sites More sharing options...
genericnumber1 Posted September 15, 2008 Share Posted September 15, 2008 code works fine for me.. try putting error_reporting(E_ALL); at the top of the script to see if there's something odd going on. Quote Link to comment Share on other sites More sharing options...
bftwofreak Posted September 16, 2008 Author Share Posted September 16, 2008 I sort of understand what's happening, but I don't know why. When I changed the <?php echo $view['1'] ?> to <?php echo $tag['1'] ?> it only had an output of the first letter. That's what's happening. I just don't know why. Any suggestions? Quote Link to comment Share on other sites More sharing options...
Garethp Posted September 16, 2008 Share Posted September 16, 2008 Instead of using $tag['1'] for your $tag array, use $tag[1] Quote Link to comment Share on other sites More sharing options...
bftwofreak Posted September 16, 2008 Author Share Posted September 16, 2008 attempted, but no dice. If you want to see what it looks like currently, here's the test link: http://updominon.com/modules.php?name=Halo_3_Stats&tag=threesixohfreak&i=rdetail&gameid=738832827 Quote Link to comment Share on other sites More sharing options...
bftwofreak Posted September 16, 2008 Author Share Posted September 16, 2008 Ok found that the issue exists within the variable itself no matter where I move the html that is to be echoed, it still only shows the first letter. Quote Link to comment Share on other sites More sharing options...
Garethp Posted September 16, 2008 Share Posted September 16, 2008 It worked fine on my server. Maybe one of these changes the variable? <script type="text/javascript" src="modules/<?php echo $module_name ?>/d/tabber.js"></script> <link rel="stylesheet" href="modules/<?php echo $module_name ?>/d/tabber.css" type="text/css" media="screen" /> <link rel="stylesheet" href="modules/<?php echo $module_name ?>/d/tabber-print.css" type="text/css" media="print" /> Quote Link to comment Share on other sites More sharing options...
bftwofreak Posted September 16, 2008 Author Share Posted September 16, 2008 Well the only thing is that it has to exist somewhere in the variable since no matter what I change the variable to, it still only shows the first character. Quote Link to comment Share on other sites More sharing options...
Garethp Posted September 16, 2008 Share Posted September 16, 2008 Try /* 1st Place */ $tag['1'] = 'threesixohfreak'; $view['1'] = '<div class="tabbertab"><h2>1st: ' . $tag['1'] . '</h2><p></p></div>'; echo $view['1']; instead Quote Link to comment Share on other sites More sharing options...
bftwofreak Posted September 16, 2008 Author Share Posted September 16, 2008 I tried that and same results: <?php $gameid = $_GET['gameid']; $rdetails = file_get_dom('http://www.bungie.net/Stats/GameStatsHalo3.aspx?gameid=' . $gameid . '&player=' . $url_player); /* 1st Place */ $tag[1] = 'threesixohfreak'; $view[1] = '<div class="tabbertab"><h2>1st: ' . $tag[1] . '</h2><p></p></div>'; echo $view[1]; ?> <script type="text/javascript" src="modules/<?php echo $module_name ?>/d/tabber.js"></script> <link rel="stylesheet" href="modules/<?php echo $module_name ?>/d/tabber.css" type="text/css" media="screen" /> <link rel="stylesheet" href="modules/<?php echo $module_name ?>/d/tabber-print.css" type="text/css" media="print" /> <div class="tabber"> </div> Quote Link to comment Share on other sites More sharing options...
bftwofreak Posted September 16, 2008 Author Share Posted September 16, 2008 ok now I've found out that it has to do with the array... <?php $gameid = $_GET['gameid']; $rdetails = file_get_dom('http://www.bungie.net/Stats/GameStatsHalo3.aspx?gameid=' . $gameid . '&player=' . $url_player); /* 1st Place */ $tag = 'threesixohfreak'; $view = '<div class="tabbertab"><h2>1st: ' . $tag . '</h2><p></p></div>'; ?> <script type="text/javascript" src="modules/<?php echo $module_name ?>/d/tabber.js"></script> <link rel="stylesheet" href="modules/<?php echo $module_name ?>/d/tabber.css" type="text/css" media="screen" /> <link rel="stylesheet" href="modules/<?php echo $module_name ?>/d/tabber-print.css" type="text/css" media="print" /> <div class="tabber"> <?php echo $view ?> </div> Any way that I can keep it in an array cause I need the array. Quote Link to comment Share on other sites More sharing options...
Garethp Posted September 16, 2008 Share Posted September 16, 2008 /* 1st Place */ $tag1 = 'threesixohfreak'; $view1 = '<div class="tabbertab"><h2>1st: ' . $tag1 . '</h2><p></p></div>'; $tag['1'] = $tag1; $view['1'] = $view1; Quote Link to comment Share on other sites More sharing options...
bftwofreak Posted September 17, 2008 Author Share Posted September 17, 2008 still no good... only shows that first character... Quote Link to comment Share on other sites More sharing options...
discomatt Posted September 17, 2008 Share Posted September 17, 2008 For some reason it seems your array isnt being defined. Try this <?php $tag = array(); $view = array(); $tag[1] = 'threesixohfreak'; $view[1] = '<div class="tabbertab"><h2>1st: ' . $tag1 . '</h2><p></p></div>'; echo htmlentities( $tag[1] )."<br />".htmlentities( $view[1] ); ?> and if that doesn't work, try this <?php $tag = array(NULL, 'threesixohfreak'); $view = array(NULL,'<div class="tabbertab"><h2>1st: ' . $tag1 . '</h2><p></p></div>'); echo htmlentities( $tag[1] )."<br />".htmlentities( $view[1] ); ?> Both output threesixohfreak <div class="tabbertab"><h2>1st: </h2><p></p></div> Quote Link to comment Share on other sites More sharing options...
bftwofreak Posted September 17, 2008 Author Share Posted September 17, 2008 well I wasn't trying to get it to show the actualy html tags, but defining the array first worked. Thanks! Now do you know how to select a range of variables within an array. ie. $tag[1] through $tag[16]. Quote Link to comment Share on other sites More sharing options...
discomatt Posted September 17, 2008 Share Posted September 17, 2008 <?php for( $i = 1; $i <= 16; $i++ ) { if ( isset($tag[$i]) ) { echo "\$tag[$i] = {$tag[$i]}<br />"; } } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.