Search the Community
Showing results for tags 'head'.
-
include "header.php"; if(isset($_GET['post_id'])) { $select=mysqli_query($con,"select...."); while($data=mysqli_fetch_array($select)) { echo "bla bla bla"; to_head("<title>asd</title><meta itemprop="name" content="asdfasdf">..."); } } include "footer.php"; This is samthing what i want... I have header.php and footer.php and any script ex news.php where how news and read SEO stuff from database and put in HEAD of the document. I tried with jquery like $("head").append(str); and it works but then i read google don't run jquery when vist website. This is done with drupal, wordpress and php-fusion Drupal: https://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_add_html_head/7 php-fusion: https://www.php-fusion.co.uk/forum/viewthread.php?thread_id=30959 so it is possible but i don't know how. Any idea?
-
For eg. I would prefer to have a link like this in the head section. <head> <script src="js/code.js"></script> </head> as oppose to like this. <head> <script> var _debug = false; var _placeholderSupport = function() { var t = document.createElement("input"); t.type = "text"; return (typeof t.placeholder !== "undefined"); }(); window.onload = function() { var arrInputs = document.getElementsByTagName("input"); var arrTextareas = document.getElementsByTagName("textarea"); var combinedArray = []; for (var i = 0; i < arrInputs.length; i++) combinedArray.push(arrInputs[i]); for (var i = 0; i < arrTextareas.length; i++) combinedArray.push(arrTextareas[i]); for (var i = 0; i < combinedArray.length; i++) { var curInput = combinedArray[i]; if (!curInput.type || curInput.type == "" || curInput.type == "text" || curInput.type == "textarea") HandlePlaceholder(curInput); else if (curInput.type == "password") ReplaceWithText(curInput); } if (!_placeholderSupport) { for (var i = 0; i < document.forms.length; i++) { var oForm = document.forms[i]; if (oForm.attachEvent) { oForm.attachEvent("onsubmit", function() { PlaceholderFormSubmit(oForm); }); } else if (oForm.addEventListener) oForm.addEventListener("submit", function() { PlaceholderFormSubmit(oForm); }, false); } } }; function PlaceholderFormSubmit(oForm) { for (var i = 0; i < oForm.elements.length; i++) { var curElement = oForm.elements[i]; HandlePlaceholderItemSubmit(curElement); } } function HandlePlaceholderItemSubmit(element) { if (element.name) { var curPlaceholder = element.getAttribute("placeholder"); if (curPlaceholder && curPlaceholder.length > 0 && element.value === curPlaceholder) { element.value = ""; window.setTimeout(function() { element.value = curPlaceholder; }, 100); } } } function ReplaceWithText(oPasswordTextbox) { if (_placeholderSupport) return; var oTextbox = document.createElement("input"); oTextbox.type = "text"; oTextbox.id = oPasswordTextbox.id; oTextbox.name = oPasswordTextbox.name; //oTextbox.style = oPasswordTextbox.style; oTextbox.className = oPasswordTextbox.className; for (var i = 0; i < oPasswordTextbox.attributes.length; i++) { var curName = oPasswordTextbox.attributes.item(i).nodeName; var curValue = oPasswordTextbox.attributes.item(i).nodeValue; if (curName !== "type" && curName !== "name") { oTextbox.setAttribute(curName, curValue); } } oTextbox.originalTextbox = oPasswordTextbox; oPasswordTextbox.parentNode.replaceChild(oTextbox, oPasswordTextbox); HandlePlaceholder(oTextbox); if (!_placeholderSupport) { oPasswordTextbox.onblur = function() { if (this.dummyTextbox && this.value.length === 0) { this.parentNode.replaceChild(this.dummyTextbox, this); } }; } } function HandlePlaceholder(oTextbox) { if (!_placeholderSupport) { var curPlaceholder = oTextbox.getAttribute("placeholder"); if (curPlaceholder && curPlaceholder.length > 0) { Debug("Placeholder found for input box '" + oTextbox.name + "': " + curPlaceholder); oTextbox.value = curPlaceholder; oTextbox.setAttribute("old_color", oTextbox.style.color); oTextbox.style.color = "#c0c0c0"; oTextbox.onfocus = function() { var _this = this; if (this.originalTextbox) { _this = this.originalTextbox; _this.dummyTextbox = this; this.parentNode.replaceChild(this.originalTextbox, this); _this.focus(); } Debug("input box '" + _this.name + "' focus"); _this.style.color = _this.getAttribute("old_color"); if (_this.value === curPlaceholder) _this.value = ""; }; oTextbox.onblur = function() { var _this = this; Debug("input box '" + _this.name + "' blur"); if (_this.value === "") { _this.style.color = "#c0c0c0"; _this.value = curPlaceholder; } }; } else { Debug("input box '" + oTextbox.name + "' does not have placeholder attribute"); } } else { Debug("browser has native support for placeholder"); } } function Debug(msg) { if (typeof _debug !== "undefined" && _debug) { var oConsole = document.getElementById("Console"); if (!oConsole) { oConsole = document.createElement("div"); oConsole.id = "Console"; document.body.appendChild(oConsole); } oConsole.innerHTML += msg + "<br />"; } } </script> </head> How can I make that happen? I rather not show that awful long code in the head.
- 2 replies
-
- javascript
- html
-
(and 3 more)
Tagged with:
-
This website that has been running for a few years now. I needed to add two menu items to the dwt template and ever since I made the changes the site loads up to the <head> tag. Here is the dwt,php file <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <?php require('..Connections/qmbl.php'); $sqlstr = "select i_html from SiteInfo where i_type = 'NEWS_SCROLL'"; $rs_scroll = mysq1_query($sqlstr, $cid); $scroll = mysql_result($rs_scroll,0,0); $sqlstr = "select team_id, t_name from Team t, Settings s where t.t_season = s.cur_season order by t_name"; $rs_teams = mysql_query($sqlstr, $cid); $count=0; $templateTeams=""; while($row = mysql_fetch_assoc($rs_teams)){$templateTeams .= '<a href="team.php?t='.$row['team_id'].'">'.$row['t_name'].'</a><br />'; } //end while ?> <!-- TemplateBeginEditable name="head" --> <!-- TemplateEndEditable --><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- TemplateBeginEditable name="doctitle" --> <title>Untitled Document</title> <!-- TemplateEndEditable --> <link href="../qmbl2010.css" rel="stylesheet" type="text/css" /> </head> <body> <table id="page" width="960" border="0" align="center" > <tr> <td><img src="../images/1ptTrans.gif" width="1" height="200" alt="image"/></td> <td> <div id="header"> <div id="topMenu"> <table width="100%" border="0"> <tr> <td align="center" valign="middle"><img src="../images/1ptTrans.gif" width="1" height="24" alt="image"/></td> <td align="center" valign="middle"><a href="../field.php">Weather</a></td> <td align="center" valign="middle"><a href="../sponsors.php">Sponsors</a></td> <td align="center" valign="middle"><a href="../advertising.php">Advertising</a></td> <td align="center" valign="middle"><a href="../contact.php">Contact</a></td> <td width="25" align="center" valign="middle"> </td> <td width="65" align="right" valign="middle"><a href="../register.php">Register</a> </td> <td align="center" valign="middle">|</td> <td width="45" align="left" valign="middle"><a href="../login.php"> Login</a> </td> </tr> </table> </div> <div id="mainMenu"> <table width="100%" border="0"> <tr> <td height="100%" align="center" valign="middle"><img src="../images/1ptTrans.gif" width="1" height="30" alt="image"/></td> <td height="100%" align="center" valign="middle"><a href="../about.php">league</a></td> <td height="100%" align="center" valign="middle"><a href="../standings.php">standings</a></td> <td height="100%" align="center" valign="middle"><a href="../schedule.php">schedules</a></td> <td height="100%" align="center" valign="middle"><a href="../scorecard.php">scorecard</a></td> <td height="100%" align="center" valign="middle"><a href="../thedugout.php">the dugout</a></td> <td height="100%" align="center" valign="middle"><a href="../news.php">news</a></td> <td height="100%" align="center" valign="middle"><a href="../products.php">products</a></td> <td height="100%" align="center" valign="middle"><a href="../rules.php">rules</a></td> <td height="100%" align="center" valign="middle"><a href="../wavier.php">wavier</a></td> <td height="100%" align="center" valign="middle"><a href="../events.php">events</a></td> </tr> </table> </div> <div id="homelink"><a href="../index.php"><img src="../images/1ptTrans.gif" width="184" height="177" border="0" alt="image" /></a></div> </div></td> </tr> <tr> <td colspan="2"><div id="scroll"><?php echo $scroll; ?></div> </td> </tr> <tr> <td><img src="../images/1ptTrans.gif" width="1" height="250" alt="image"/></td> <td class="body"><!-- TemplateBeginEditable name="body" --><!-- TemplateEndEditable --></td> </tr> <tr> <td><img src="../images/1ptTrans.gif" width="1" height="150" alt="image"/></td> <td valign="top" class="bottomMenu"><table width="100%" border="0"> <tr> <th scope="col"><a href="../index.php">QMBL</a></th> <th scope="col"><a href="../thedugout.php">The Dugout</a></th> <th scope="col">QMBL League</th> <th scope="col">QMBL Links</th> <th scope="col">QMBL Office</th> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td><a href="../about.php">About</a><br /> <a href="../awards.php">Awareds</a><br /> <a href="../news.php">News</a><br /> <a href="../events.php">Special Events</a><br /> <a href="../products.php">Products</a><br /> <a href="../field.php">Weather</a></td> <td><?php echo $templateTeams; ?></td> <td><a href="../scorecard.php">Scorecard</a><br /> <a href="../standings.php">Standings</a><br /> <a href="../schedule.php">Schedules</a></td> <td><a href="http://www.mlb.com">MLB</a><br /> <a href="http://www.nfl.com">NFL</a><br /> <a href="http://www.nba.com">NBA</a><br /> <a href="http://www.nhl.com">NHL</a><br /> <a href="http://www.espn.com">ESPN</a><br /> <a href="../games.php">Fun</a></td> <td><a href="../contact.php">Contact</a><br /> <a href="../advertising.php">Advertise with us</a><br /> <a href="../sponsors.php">Sponsors</a><br /> <a href="../poll.php">Poll</a></td> </tr> </table></td> </tr> </table> </body> </html> It error checks but it wont load. Thanks in advance for you help. Kohron J Burton Kohron J Burton LLC