PHP - Logo Help
How would I get a logo to appear within my search page? I have this png file it is called the following:
wvb-logo-slogen.png
the png file is located under the /mnt/www/html directory.
Here is the code that I am trying to use to get this logo to be displayed on my web page:
<?php if (!isset($_POST['q'])) { ?>
<!-- begin logo --> <div id="logo"> <a href="home"><img src="/mnt/www/html/wvb-logo-slogen.png" border="0" /></a> </div> <!-- end logo --> <h2>Search</h2> <form method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>"> <input type="text" name="q" size="30" /> </form> <?php } else { ?> <h2>Search Results</h2> <?php try { // create object // $swish = new Swish('/usr/local/apache/htdocs/swish/index.swish-e'); $swish = new Swish('/var/www/html/pdf2/index.swish-e'); // get and run query from command-line $queryStr = htmlentities($_POST['q']); $result = $swish->query($queryStr); ?> Found <?php echo $result->hits; ?> match(es) for '<?php echo $queryStr; ?>' . <?php // iterate over result set // print details for each match while($r = $result->nextResult()) { ?> <p> <?php echo $r->swishreccount; ?> <strong> <a href="<?php echo '/pdf2', ltrim($r->swishdocpath, '.') ; ?>"> <?php echo $r->swishdocpath; ?> </a> </strong> (sco <?php echo $r->swishrank; ?>) <br/> <?php echo $r->swishdocpath; ?> </p> <?php } } catch (Exception $e) { die('ERROR: ' . $e->getMessage()); } } ?> </body> </html> My questions are the following: Why isn't my logo displaying? Is it the right format? Are there special html or php items that I need to put in order for my logo to be displayed right above the word "Search"? Any assistance would truly be appreciated because I have no experience using php. Similar Tutorials(Trying to get my brain back into this old problem which I fixed but want to re-code a better way...) So I was having problems with getting some browser error when people would go to checkout because the page logo was coming from an HTTP source and the page was an HTTPS page. I created a "config" file and had this code... Code: [Select] <?php define('ENVIRONMENT', 'development'); //define('ENVIRONMENT', 'production'); // Secure Web Server Root define('SECURE_WEB_ROOT', ENVIRONMENT === 'development' ? 'http://local.dev3/' : 'https://www.mysite.com/'); ?> Then in my page I had... Code: [Select] <div id="header"> <a href="<?php echo WEB_ROOT ?>index.php"> <img id="logo" src="<?php echo SECURE_WEB_ROOT ?>images/mylogo_200x50.png" width="200" alt="My Logo" /> </a> </div> Is there a better way to do this and eliminate my Config file which is no longer needed since I learned how to create a "Virtual Server"? Debbie I posted yesterday and wasnt very clear or the question was way to broad... here is my issue condensed and hoping someone can help me... I am using a sports component and mods in Joomla 1.5 --- that displays a standings table with game results- next game... i am trying to drop/add the team logo next to the team name in the table/s... this is the code from the team page echoing the logo and putting it next to the team name--- see bottom where i have it spaced out.... as you can expect it isn't working of course Code: [Select] <?php if ($this->params->get('team_logo') == 1 && $this->team->logo) { ?> <!-- team logo --> <div style="display: inline; float: left; padding-left: 2px;"> <img src="<?php echo JURI::base() . $this->params->get('images_path') . $this->team->logo;?>" alt="<?php echo stripslashes($this->team->name);?>" title="<?php echo stripslashes($this->team->name);?>" border="1" /><br /> <br /> </div> <!-- team logo --> <?php } ?> and here is the code from the standings module: i highlighted where in the table the logo would be called... i understand broad question here; but, was hoping someone could help me out with this... Code: [Select] <?php /** * @version $Id: mod_gridiron_win_loss.php, v1.5.0 March 2011 01:32:15 * @author Fastball Productions * @package Gridiron * @copyright Copyright (C) 2011 Fastball Productions * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ // no direct access defined('_JEXEC') or die('Restricted access'); $db =& JFactory::getDBO(); // get the module parameters $heading = $params->get( 'heading', '' ); $seasonid = $params->get( 'seasonid', '1' ); $gametypes = $params->get( 'gametypes', '1' ); $teamids = $params->get( 'teamids', '' ); $leagueids = $params->get( 'leagueids', '' ); $divisionids = $params->get( 'divisionids', '0' ); $wheading = $params->get( 'wheading', 'Wins' ); $lheading = $params->get( 'lheading', 'Losses' ); $winpctheading = $params->get( 'pctheading', 'Winning Percentage' ); $gamesplayedheading = $params->get( 'gpheading', 'Games Played' ); $pointsforheading = $params->get( 'pfheading', 'Points For' ); $pointsagainstheading = $params->get( 'paheading', 'Points Against' ); $theading = $params->get( 'theading', 'Ties' ); $showties = $params->get( 'showties', 0 ); if (is_array($gametypes)) { $gametypes = implode(',', $gametypes); } if (is_array($teamids)) { $teamids = implode(',', $teamids); } if (is_array($leagueids)) { $leagueids = implode(',', $leagueids); } if (is_array($divisionids)) { $divisionids = implode(',', $divisionids); } // win/loss/ties variables; $wins = 0; $losses = 0; $ties = 0; // if there are team ids, division ids, or league ids configured, get all of the divisions to separate them; if ($teamids || $divisionids || $leagueids) { if ($teamids) { //$db->setQuery("SELECT d.id, d.division FROM #__fastball_division AS d LEFT JOIN #__fastball_team AS t ON d.id = t.divisionid WHERE (t.published = 1 AND t.divisionid IS NOT NULL AND FIND_IN_SET(t.id, '{$teamids}')) GROUP BY d.id ORDER BY d.division"); $divisions[] = -1; } else if ($divisionids) { //$db->setQuery("SELECT d.id, d.division FROM #__fastball_division AS d LEFT JOIN #__fastball_team AS t ON d.id = t.divisionid WHERE (t.published = 1 AND t.divisionid IS NOT NULL AND FIND_IN_SET(d.id, '{$divisionids}')) GROUP BY d.id ORDER BY d.division"); $db->setQuery("SELECT d.id, d.division FROM #__gridiron_division AS d LEFT JOIN #__gridiron_team AS t ON d.id = t.divisionid LEFT JOIN #__gridiron_schedule AS s ON (t.id = s.visitingteam OR t.id = s.hometeam) WHERE (t.published = 1 AND t.divisionid IS NOT NULL AND FIND_IN_SET(d.id, '{$divisionids}') AND s.season = {$seasonid} AND FIND_IN_SET(s.gametype, '$gametypes')) GROUP BY d.id ORDER BY d.division"); $divisions = $db->loadObjectList(); } else { $db->setQuery("SELECT d.id, d.division FROM #__gridiron_division AS d LEFT JOIN #__gridiron_team AS t ON d.id = t.divisionid LEFT JOIN #__gridiron_schedule AS s ON (t.id = s.visitingteam OR t.id = s.hometeam) WHERE (t.published = 1 AND t.divisionid IS NOT NULL AND FIND_IN_SET(d.leagueid, '{$leagueids}') AND s.season = {$seasonid} AND FIND_IN_SET(s.gametype, '$gametypes')) GROUP BY d.id ORDER BY d.division"); $divisions = $db->loadObjectList(); } } if (!function_exists('getStandingsTeamsModule')) { function getStandingsTeamsModule($divisionid, $seasonid, $teamids, $gametypes) { $db =& JFactory::getDBO(); $seasonid = intval($seasonid); $divisionid = intval($divisionid); if ($teamids) { $db->setQuery("SELECT a.id AS value, a.name AS text FROM #__gridiron_team AS a LEFT JOIN #__gridiron_schedule AS s ON (a.id = s.visitingteam OR a.id = s.hometeam) WHERE (a.published = 1 AND FIND_IN_SET(a.id, '$teamids') AND FIND_IN_SET(s.gametype, '$gametypes') AND s.season = {$seasonid}) ORDER BY a.name"); } else { $db->setQuery("SELECT a.id AS value, a.name AS text FROM #__gridiron_team AS a LEFT JOIN #__gridiron_schedule AS s ON (a.id = s.visitingteam OR a.id = s.hometeam) WHERE (a.published = 1 AND a.defaultteam = 1 AND a.divisionid = {$divisionid} AND FIND_IN_SET(s.gametype, '$gametypes') AND s.season = {$seasonid}) ORDER BY a.name"); } $teamlist = $db->loadObjectList(); /* array to store the wins, losses, ties, and teamid; */ $gamedata = array(); /* go through each teams schedule and get their wins, losses, and ties so that we know how to order the league standings; */ foreach ($teamlist as $team) { $wins = $losses = $ties = $gamesplayed = 0; /* now get the total points for each team and each game; */ $db->setQuery("SELECT s.hometeam, s.visitingteam, b.finalv, b.finalh FROM #__gridiron_schedule AS s LEFT JOIN #__gridiron_boxscore AS b ON b.gameid = s.id WHERE (s.scored = 1 AND s.season = {$seasonid} AND (s.visitingteam = {$team->value} OR s.hometeam = {$team->value}))"); $games = $db->loadObjectList(); /* go through each game and count the wins/losses/ties for the team then dump the results into an array for sorting; */ foreach ($games as $game) { $gamesplayed++; if ($game->hometeam == $team->value) { if ($game->finalh > $game->finalv) { $wins++; } else if ($game->finalh < $game->finalv) { $losses++; } else { $ties++; } } else { if ($game->finalv > $game->finalh) { $wins++; } else if ($game->finalv < $game->finalh) { $losses++; } else { $ties++; } } } /* calculate winning percentage; */ $winpct = $wins + ($ties*.5); if ($gamesplayed > 0) { $winpct = $winpct/$gamesplayed; } else { $winpct = 0; } $winpct = number_format($winpct, 3); $gamedata[] = array('winpct' => $winpct, 'wins' => $wins, 'losses' => $losses, 'ties' => $ties, 'teamid' => $team->value); } /* sort the gamedata array by winpct, wins, losses, ties; */ $winpct = $wins = $losses = $ties = array(); foreach ($gamedata as $key => $value) { $winpct[$key] = $value['winpct']; $wins[$key] = $value['wins']; $losses[$key] = $value['losses']; $ties[$key] = $value['ties']; } array_multisort($winpct, SORT_DESC, $wins, SORT_DESC, $losses, SORT_ASC, $ties, SORT_ASC, $gamedata); $teamsort = array(); foreach ($gamedata as $game) { $teamsort[] = $game['teamid']; } /* teamsort will be used to order the database results so that the team with the best record is on top; */ $teamsort = implode(',', $teamsort); if ($teamids) { $db->setQuery("SELECT t.* FROM #__gridiron_team AS t WHERE (t.published = 1 AND FIND_IN_SET(t.id, '$teamids')) ORDER BY FIND_IN_SET(id, '$teamsort')"); } else { $db->setQuery("SELECT t.* FROM #__gridiron_team AS t WHERE (t.published = 1 AND t.defaultteam = 1 AND t.divisionid = {$divisionid}) ORDER BY FIND_IN_SET(id, '$teamsort')"); } $teams = $db->loadObjectList(); return $teams; } } if (!function_exists('getStandingsStatsModule')) { function getStandingsStatsModule($teams, $seasonid, $gametypes) { $db =& JFactory::getDBO(); $i = 0; $standings = array(); /* go through each team and get their wins, losses, and ties; */ foreach ($teams as $team) { $wins = $losses = $ties = $gamesplayed = $pointsfor = $pointsagainst = 0; /* now get the total points for each team and each game; */ $db->setQuery("SELECT s.hometeam, s.visitingteam, b.finalv, b.finalh FROM #__gridiron_schedule AS s LEFT JOIN #__gridiron_boxscore AS b ON b.gameid = s.id WHERE (s.scored = 1 AND s.season = {$seasonid} AND (s.visitingteam = {$team->id} OR s.hometeam = {$team->id}))"); $games = $db->loadObjectList(); /* go through each game and count the wins/losses/ties for the team then dump the results into an array for sorting; */ foreach ($games as $game) { $gamesplayed++; if ($game->hometeam == $team->id) { $pointsfor = $pointsfor + $game->finalh; $pointsagainst = $pointsagainst + $game->finalv; if ($game->finalh > $game->finalv) { $wins++; } else if ($game->finalh < $game->finalv) { $losses++; } else { $ties++; } } else { $pointsfor = $pointsfor + $game->finalv; $pointsagainst = $pointsagainst + $game->finalh; if ($game->finalv > $game->finalh) { $wins++; } else if ($game->finalv < $game->finalh) { $losses++; } else { $ties++; } } } /* create an object with the team stats to return in the array; */ $obj = new stdClass(); $obj->id = $team->id; $obj->name = stripslashes($team->name); $obj->leagueid = $team->leagueid; $obj->gamesplayed = $gamesplayed; $obj->wins = $wins; $obj->losses = $losses; $obj->ties = $ties; $obj->pointsfor = $pointsfor; $obj->pointsagainst = $pointsagainst; $obj->winpct = $wins + ($ties*.5); if ($obj->gamesplayed > 0) { $obj->winpct = $obj->winpct/$gamesplayed; } else { $obj->winpct = 0; } $standings[] = $obj; $i++; } return $standings; } } ?> <?php if ($teamids || $divisionids || $leagueids) { ?> <table width="100%" border="0" align="center"> <tr> <td colspan="4" style="text-align:center;font-size:18px;"><b><?php echo $heading;?></b></td> </tr> <?php foreach ($divisions as $did) { ?> <tr> <td style="text-align:center; width:4px; "></td> <td bgcolor="#990000" style="text-align:left; width: 200px; border-bottom: 0px #000 solid; color: #FFF;"><b>Team</b></td> <td bgcolor="#990000" style="text-align:center; width:20px; border-bottom: 0px #000 solid; color:#FFF;"><b><?php echo $wheading;?></b></td> <td bgcolor="#990000" style="text-align:center; width:20px; border-bottom: 0px #000 solid; color:#FFF;"><b><?php echo $lheading;?></b></td> <td bgcolor="#990000" style="text-align:center; width:50px; border-bottom: 0px #000 solid; color: #FFF;"><b>Pct.</b></td> <td bgcolor="#990000" style="text-align:center; width:30px; border-bottom: 0px #000 solid; color: #FFF;"><b>GP</b></td> <td bgcolor="#990000" style="text-align:center; width:30px; border-bottom: 0px #000 solid; color: #FFF;"><b>PF</b></td> <td bgcolor="#990000" style="text-align:center; width:30px; border-bottom: 0px #000 solid; color: #FFF;"><b>PA</b></td> <td style="text-align:center; width:4px; "></td> <?php if ($showties) { ?> <td style="text-align:center; width:25px;"><b><?php echo $theading;?></b></td> <?php } ?> </tr> <?php $teams = getStandingsTeamsModule($did->id, $seasonid, $teamids, $gametypes);?> <?php $statdata = getStandingsStatsModule($teams, $seasonid, $gametypes); ?> <?php foreach ($statdata as $stats) { ?> <?php $stats->shortname == '' ? $name = $stats->name:$name = $stats->shortname;?> <tr> [color=purple][i][b]<td style="text-align:center; width:4px;"></td>[/b][/i][/color] <td style="text-align:left; width: 200px; font-size: 12px;"><a href="<?php echo JRoute::_("index.php?option=com_gridiron&view=team&id=$stats->id");?>"><?php echo $name;?></a></td> <td style="text-align:center; width:20px;"><?php echo $stats->wins ? $stats->wins:0;?></td> <td style="text-align:center; width:20px;"><?php echo $stats->losses ? $stats->losses:0;?></td> <td style="text-align:center; width:50px;"><?php echo number_format($stats->winpct, 3)?></b></td> <td style="text-align:center; width:30px;"><?php echo $stats->gamesplayed;?></td> <td style="text-align:center; width:30px;"><?php echo $stats->pointsfor;?></td> <td style="text-align:center; width:30px;"><?php echo $stats->pointsagainst;?></td> <td style="text-align:center; width:4px;"></td> <?php if ($showties) { ?> <td style="text-align:center; width:25px;"><?php echo $stats->ties ? $stats->ties:0;?></td> <?php } ?> </tr> <?php } ?> <tr><td colspan="4"></td></tr> <?php } ?> </table> <?php } ?> thanks trey Dear All, Hope all are fine. Need one hep to align the logo in the center of the footer. I tried align = Center but didn't help, please see below code ad advise. <div class="image"> <img src="images/icon/logo.jpg" alt="John Doe"/> </div>
Kind Regards, Naveed. Edited August 2, 2020 by Naveed786Hi Guys, I'm going to try and watermark my uploaded images with a small logo (placed onto the original image) so they are all watermarked, is there any tutorials anyone can recommend to do this? i can't seem to find any online. thanks for any help guys Graham Hi Folks, This is my first post here and I was wondering if anyone could help me out at all please. I would basically like to change the logo on the home page based on whether a query string from a referring URL has a specific value. It's an affiliate URL for an online store, so essentially I need to get the referrer, check if the query string adnetwork = as and then replace the logo if it does, if not leave it as it is. Does that make sense? Any help would very much appreciated. I was thinking along the lines of: <?php if ($_GET('adnetwork') == 'as') { changeLogo(); } else { leaveLogo(); } ?> Am I along the right lines folks? |