Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

zantzinger

Members
  • Joined

  • Last visited

Everything posted by zantzinger

  1. just in case this helps anyone in the future I hadn't specified top/right properties for the absolutely positioned header, which wasn't a problem for any other browser (I think) because all other elements are floated in my layout. Still, the colours and text are pretty ugly on a PC I happened to use yesterday. Looks fine on my Mac.
  2. My site (http://www.oxfordpoetry.co.uk) seems to be displaying really badly in ie6 and ie7 when i check browsershots.org. It seems that the header is below the maincontent in ie6 and off to the right in ie7. I'm quite puzzled. Here's the CSS... /******* LAYOUT *******/ * html { margin:0; padding:0; border:0; } body { text-align: center; background-color:#fff; } #mainContainer { width: 760px; margin: 0 auto; /* We are going to center this design */ padding:0 2em; text-align: left; /* Since we used text-align: center in the body to be sure some older IE versions are going to center our design, we now align the text left */ } #header { width: 760px; position:absolute; padding: 0 2em; clear:both; text-align:right; } #maincontent { position:relative; padding-top:250px; text-align:left; float: left; /* Our content is going to be left aligned */ width: 550px; } #rss { position: relative; float: right; width: 210px; margin: 260px -2em 10em 0em; } #footer { clear: both; /* We have to clear our floats */ width: 100%; /* We need to set the width on the footer since it's outside the mainContainer, and therefore isn't controlled by it */ margin: 0 auto; /* We need to center the footer */ padding: 0.3em 0em; text-align:center; background: #e6e6e6; } /********* HEADER **************/ #logo{ margin: 2em 0 0 auto; width: 408px; height: 133px; background: url(../images/oxpologo.png); } #quotationpara{ margin: -20px 0 0 auto; padding: 0 3em 0 10em; height: 3em; } /*******TEXT STYLES*********/ #quotationpara p{ color: #987b8d; font: 0.9em/1.2em 'Cambria', 'Georgia', 'Times New Roman', serif; text-align: right; } .quoters { color: #474747; } a { color: #463c3c; text-decoration: underline; } a:hover { color: #000000; text-decoration: underine; } #maincontent h2 { margin: 0 1em 0 -0.9em; color: #463c3c; font: 1.3em/1.2em 'avant garde', 'century gothic', sans-serif; letter-spacing: 0.1em; font-variant: small-caps; border-bottom: medium solid #9999cc; } /*initial schpiel*/ #maincontent h4 { color: #76596b; font: 0.9em/1.3em 'Cambria', 'Georgia', 'Times New Roman', serif; } /*Contents title for historical issues*/ #maincontent h5 { color: #463c3c; font: 1em/1.6em 'avant garde', 'century gothic', sans-serif; letter-spacing: 0.1em; font-variant: small-caps; } /*interviewer's question*/ #maincontent h6 { margin: 0 0 0 -1.2em; font: 0.9em/1.3em 'helvetica', 'arial', sans-serif; color: #241a1a; font-style:italic; padding-top:1.3em; } #maincontent p{ color: #463c3c; font: 0.9em/1.4em 'helvetica', 'arial', sans-serif; } #maincontent p.interviewee { margin: 0 0 0 1.3em; padding-top:1em; } #maincontent ul, #maincontent ol { color: #463c3c; font: 0.9em/1.4em 'helvetica', 'arial', sans-serif; } #rss h5 { margin:-0.5em 0em; text-align: right; background-color: #b9dfdf; color: #666; font: 1.3em 'Cambria', 'Georgia', 'Times New Roman', serif; } #rss h6 { text-align: right; color: grey; font: 0.6 'Cambria', 'Georgia', 'Times New Roman', serif; } #rss p { color: black; font: 0.9em/1.2em 'Cambria', 'Georgia', 'Times New Roman', serif; } #rss a { background-color:#b9dfdf; font: 0.8em 'Cambria', 'Georgia', 'Times New Roman', serif; } #footer h4 { font:1.2em/1.2em 'avant garde', 'century gothic', 'courier new', sans-serif; } #footer h6 { text-align: right; font: 0.6em 'avant garde', 'century gothic', 'courier new', sans-serif; } #footer p { font: 0.7em/1em 'avant garde', 'century gothic', 'courier new', sans-serif; } /***************NAV********************/ #nav { /*float: left;*/ font-size: 0.8em; /* could be specified at a higher level */ margin: 1em auto 1em auto; padding: 0 10px 0 10px; /*border-bottom: 1px solid #333;*/ } #nav li { /*float: left;*/ margin: 0 1em 0 1em; padding: 0; display: inline; list-style: none; } #nav a:link, #nav a:visited { /*float: left;*/ /*font-size: 85%;*/ line-height: 20px; font-weight: bold; /*margin: 0 10px 0 10px;*/ text-decoration: none; color: #999; } #nav a.active:link, #nav a.active:visited, #nav a:hover { border-bottom: 4px solid #333; padding-bottom: 2px; color: #333; } /* *** Float containers fix: http://www.csscreator.com/attributes/containedfloat.php *** */ .clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } .clearfix{display: inline-block;} /* Hides from IE-mac \*/ * html .clearfix{height: 1%;} .clearfix{display: block;} /* End hide from IE-mac */
  3. this is my solution, which seems to work nicely $reader = new XMLReader; $res = $reader->open('http://www.blogger.com/feeds/17146895/posts/default'); $entry = false; $i=1; while ($reader->read() && $i<=5) { if ($reader->name == 'entry') { if ($reader->nodeType == XMLReader::ELEMENT) { $entry = true; $i++; } else { $entry = false; } } if ($entry && ($reader->name == 'content')) { $reader->read(); if (($reader->name == '#text') && $reader->hasValue) { echo '<p>' . $reader->value . '</p>'; } } }
  4. What's the XMLReader class? Sorry - I'm a noob!
  5. This script is meant to pull 4 <content> tags from an external page and echo the values. However, it seems to echo all of the <content> tag values but I don't understand why my counter loop is not working. <?php $reader = new XMLReader; $res = $reader->open('http://www.blogger.com/feeds/17146895/posts/default'); $entry = false; for ($i=1; $i<=4; $i++){ while ($reader->read()) { if ($reader->name == 'entry') { if ($reader->nodeType == XMLReader::ELEMENT) { $entry = true; } else { $entry = false; } } if ($entry && ($reader->name == 'content')) { $reader->read(); if (($reader->name == '#text') && $reader->hasValue) { echo '<p>' . $reader->value . '</p>'; } } } } ?>
  6. I use require to call an external menu.php file for my webpages. The nav has simple css styling so that, when a visitor is on page foo.php, foo in the nav is highlighted. Is it faster and more legible to 1. use if statements inside html tags, or 2. use switch and have a menu.php file that is three times the size? code for 1 <div> <ul id="nav"> <li><a href="shop.php" <?php echo ($page=='shop.php'?'class="active"':'');?>>shop</a></li> <li><a href="submit.php" <?php echo ($page=='submit.php'?'class="active"':'');?>>submit</a></li> <li><a href="index.php" <?php echo ($page=='index.php'?'class="active"':'');?>>home</a></li> <li><a href="texts.php" <?php echo ($page=='texts.php'?'class="active"':'');?>>online texts</a></li> <li><a href="history.php" <?php echo ($page=='history.php'?'class="active"':'');?>>history<a/></li> <li><a href="links.php" <?php echo ($page=='links.php'?'class="active"':'');?>>events & links</a></li> <li><a href="contact.php" <?php echo ($page=='contact.php'?'class="active"':'');?>>contact</a></li> </ul> </div> code for 2 <?php switch($page){ case "shop.php": echo '<div> <ul id="nav"> <li><a href="shop.php" class="active">shop</a></li> <li><a href="submit.php">submit</a></li> <li><a href="index.php">home</a></li> <li><a href="texts.php">online texts</a></li> <li><a href="history.php">history<a/></li> <li><a href="links.php">events & links</a></li> <li><a href="contact.php">contact</a></li> </ul> </div>'; break; case "submit.php": echo '<div> <ul id="nav"> <li><a href="shop.php">shop</a></li> <li><a href="submit.php" class="active">submit</a></li> <li><a href="index.php">home</a></li> <li><a href="texts.php">online texts</a></li> <li><a href="history.php">history<a/></li> <li><a href="links.php">events & links</a></li> <li><a href="contact.php">contact</a></li> </ul> </div>'; break; ETC ETC ETC ETC ETC
  7. ok, I'm now using XMLReader to return the text value of <title> and <content> tags from an xml file, but it only echoes the first tag it finds. I'm not sure how to use foreach in the code below. <?php $reader = new XMLReader(); $reader -> open('http://www.blogger.com/feeds/17146895/posts/default'); while ($reader->read()) { if ($reader->name == "title" | "content" && $reader->nodeType == XMLReader::ELEMENT) { $input = ""; while ($reader->read()) { if ($reader->nodeType == XMLReader::TEXT || $reader->nodeType == XMLReader::CDATA || $reader->nodeType == XMLReader::WHITESPACE || $reader->nodeType == XMLReader::SIGNIFICANT_WHITESPACE) { $input .= $reader->value; } else if ($reader->nodeType == XMLReader::END_ELEMENT && $reader->name == "title" | "content") { break; } } break; } } echo $input; $reader -> close(); ?>
  8. Thanks very much for your prompt replies. I'm not looking to include a whole file though. Effectively I'm creating some sort of custom RSS feed. Someone helpfully posted this, which with some tweaking, should work very well : <?php function doTransaction($host, $page, $UseSSL = 1) { if($UseSSL == 1){ $port = 443; $socket = fsockopen("ssl://".$host,$port); } else { $port = 80; $socket = fsockopen($host,$port); } if(!$socket) // Connection failed, you can use this error how you wish, ill just die { die("socket failed: could not connect to server"); } else // We have a connection, now get the data { $in = "GET /" . $page . " HTTPS/1.0\r\n\r\n"; // Send GET command $out = ''; // initialize $rawData = ''; // fsockopen returns a file pointer, which means we can use php's file functions to write and read data fputs($socket,$in); // Send the server our request // Read response while ( $out=fread ($socket,2048) ) { // Save in rawdata $rawData .= $out; } // Parse the string into lines $Lines = explode( "\r", $rawData ); // Get # of lines $NumLines = count( $Lines ); // The header contains page data, then a blank line... skip it $i = 0; while ( trim( $Lines[ $i ] ) != "" ) { $i = $i + 1; } // Now we have the location of the html source code.. start our search here $StartLine = $i; // Parse lines $startTag = "<div class=\"post\">"; // This is the tag you would be searching for... you could pass this in as an argument if you wish $endTag = "</div>"; // This is where your search will end. if you have divs inside this div, then the search will be messed up. you can code around it though. For this example, I won't $tagLength = strlen($startTag); // This is an offset made to skip over the $startTag //Let's start for ( $i = $StartLine; $i < $NumLines; $i++ ) { // Get Tag Positions $startTagPos = stripos($Lines[$i], $startTag); $endTagPos = stripos($Lines[$i], $endTag); // Note the !==, stripos can return 0 but not be false if($startTagPos !== false && $endTagPos !== false) { // Get the string inside the tags $stringYouWant = substr($Lines[$i], ($startTagPos+$tagLength), ($endTagPos-($startTagPos+$tagLength))); // Do what you want here, I echoed it for testing purposes echo htmlentities($stringYouWant); } } } } ?> <html><head></head><body> <?php doTransaction("example.com","pagename.asp"); ?> </body></html>
  9. I am a PHP noob and I've been building a website with elements of PHP. I'd like to write a script that will select exactly the HTML elements that I want from an external page. So, I'd like to fetch <div class="post"> and <div class="poem"> content from an external website and have it display in my own page. I don't know which functions and variables I should be thinking about though. Any help is gratefully appreciated.
  10. I've been trying to write my main content above the menu and logo in the html but no matter what i've tried it doesn't seem to display correctly (i.e. below the menu and logo). It's a one-column basic centred layout. Any help is gratefully appreciated. Thanks! html !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>MYSITE</title> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <link rel="stylesheet" href="css/main.css" type="text/css" /> </head> <body> <?php $page=$_SERVER['REQUEST_URI']; require_once ("menu.php"); ?> <div id="pagewidth" > <div id="wrapper" class="clearfix"> <div id="maincol"> <div id="logo"> </div> <div id="quotationpara"> <p>"One of the best small magazines in the country"<span class="quoters"> Tom Paulin</span><br /> "Glad to be in such good company"<span class="quoters"> Seamus Heaney</span></p> </div> <div id="maincontent"> <p>lots of text</p> </div> </div> <!--closing maincol--> </div> <!--closing wrapper--> <div id="footer" > Footer </div> </div> <!--closing pagewidth--> </body> </html> and here's the css /******* LAYOUT *******/ html, body{ margin:0; padding:0; text-align:center; background-color: #ffffff; } #pagewidth{ width:100%; text-align:left; margin-left:auto; margin-right:auto; } #maincol{ display:inline; position: relative; width:80%; } #footer{ height:10em; background-color:#FFFFFF; clear:both; } #logo{ margin: 3em auto 0 auto; width: 408px; height: 133px; background: url(../images/oxpologo.png); } #quotationpara{ margin: 0 auto; width: 60%; height: 3em; } #maincontent{ margin: 3em auto 0 auto; width: 600px; } /*******TEXT STYLES*********/ #quotationpara p{ margin-top: 0; padding: 0; color: #987b8d; font: 0.9em/1.2em 'Cambria', 'Georgia', 'Times New Roman', serif; text-align: center; z-index: 5; } .quoters { color: #474747; } #maincontent h2 { margin-left: -0.8em; padding: 0; color: #463c3c; font: 1.3em/1.2em helvetica,sans-serif; } #maincontent p, ul{ padding: 0; color: #463c3c; font: 0.9em/1.4em helvetica,sans-serif; } a { color: #463c3c; text-decoration: underline; } a:hover { color: #000000; text-decoration: underine; } /***************NAV********************/ #nav { /*float: left;*/ font-size: 0.8em; /* could be specified at a higher level */ margin: 1em auto 1em auto; padding: 0 10px 0 10px; /*border-bottom: 1px solid #333;*/ } #nav li { /*float: left;*/ margin: 0 1em 0 1em; padding: 0; display: inline; list-style: none; } #nav a:link, #nav a:visited { /*float: left;*/ /*font-size: 85%;*/ line-height: 20px; font-weight: bold; /*margin: 0 10px 0 10px;*/ text-decoration: none; color: #999; } #nav a.active:link, #nav a.active:visited, #nav a:hover { border-bottom: 4px solid #333; padding-bottom: 2px; color: #333; } /* *** Float containers fix: http://www.csscreator.com/attributes/containedfloat.php *** */ .clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } .clearfix{display: inline-block;} /* Hides from IE-mac \*/ * html .clearfix{height: 1%;} .clearfix{display: block;} /* End hide from IE-mac */

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.