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? Link to comment https://forums.phpfreaks.com/topic/124272-awkward-output/ 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. Link to comment https://forums.phpfreaks.com/topic/124272-awkward-output/#findComment-641723 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? Link to comment https://forums.phpfreaks.com/topic/124272-awkward-output/#findComment-642508 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] Link to comment https://forums.phpfreaks.com/topic/124272-awkward-output/#findComment-642510 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 Link to comment https://forums.phpfreaks.com/topic/124272-awkward-output/#findComment-642514 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. Link to comment https://forums.phpfreaks.com/topic/124272-awkward-output/#findComment-642516 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" /> Link to comment https://forums.phpfreaks.com/topic/124272-awkward-output/#findComment-642517 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. Link to comment https://forums.phpfreaks.com/topic/124272-awkward-output/#findComment-642519 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 Link to comment https://forums.phpfreaks.com/topic/124272-awkward-output/#findComment-642521 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> Link to comment https://forums.phpfreaks.com/topic/124272-awkward-output/#findComment-642523 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. Link to comment https://forums.phpfreaks.com/topic/124272-awkward-output/#findComment-642524 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; Link to comment https://forums.phpfreaks.com/topic/124272-awkward-output/#findComment-642541 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... Link to comment https://forums.phpfreaks.com/topic/124272-awkward-output/#findComment-643525 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> Link to comment https://forums.phpfreaks.com/topic/124272-awkward-output/#findComment-643529 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]. Link to comment https://forums.phpfreaks.com/topic/124272-awkward-output/#findComment-643530 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 />"; } } ?> Link to comment https://forums.phpfreaks.com/topic/124272-awkward-output/#findComment-643566 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.