<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Advanced CSS Design Resources - last-child.com &#187; Unordered List</title>
	<atom:link href="http://www.last-child.com/category/html-elements/unordered-list/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.last-child.com</link>
	<description>CSS Toys for Professional Web Developers</description>
	<lastBuildDate>Thu, 08 Jul 2010 16:59:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Add Pagination to your Yahoo! BOSS search engine</title>
		<link>http://www.last-child.com/pagination-boss-search-engine/</link>
		<comments>http://www.last-child.com/pagination-boss-search-engine/#comments</comments>
		<pubDate>Fri, 12 Sep 2008 15:07:52 +0000</pubDate>
		<dc:creator>Ted</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Unordered List]]></category>
		<category><![CDATA[YUI]]></category>
		<category><![CDATA[Yahoo!]]></category>
		<category><![CDATA[Application programming interface]]></category>
		<category><![CDATA[Cross Site Scripting]]></category>
		<category><![CDATA[Design pattern]]></category>
		<category><![CDATA[Web search engine]]></category>

		<guid isPermaLink="false">http://www.last-child.com/?p=161</guid>
		<description><![CDATA[Yahoo&#8217;s BOSS search API makes it easy for you to create a customized search engine. Yahoo! also has a Design Pattern lLibrary to save time designing your pages. They&#8217;ve put a lot of effort into creating the best user experience for search pagination. Pagination guidelines Here&#8217;s a sample of the Design Library&#8217;s ideas for search [...]]]></description>
			<content:encoded><![CDATA[<p>
<a href="http://developer.yahoo.com/ypatterns/pattern.php?pattern=searchpagination"><img src="http://developer.yahoo.com/ypatterns/images/ysearch-page7.png" alt="Search pagination example"></a><a href="http://developer.yahoo.com/search/boss">Yahoo&#8217;s BOSS search API</a> makes it easy for you to create a customized search engine. Yahoo! also has a <a href="http://developer.yahoo.com/ypatterns/index.php">Design Pattern lLibrary</a> to save time designing your pages. They&#8217;ve put a lot of effort into creating the best user experience for <a href="http://developer.yahoo.com/ypatterns/pattern.php?pattern=searchpagination">search pagination</a>. </p>
<h3>Pagination guidelines</h3>
<p>Here&#8217;s a sample of the Design Library&#8217;s ideas for search pagination.</p>
<blockquote cite="http://developer.yahoo.com/ypatterns/pattern.php?pattern=searchpagination">
<ul>
<li>Display the navigation controls as a row of links.</li>
<li>Present links in the following order: &#8216;Prev&#8217;, page links, &#8216;Next&#8217;.</li>
<li>Display a left arrow after the label &#8216;Prev&#8217;.</li>
<li>Display a right arrow before the label &#8216;Next&#8217;.</li>
<li>Make the arrow(s) clickable.</li>
<li>The page links should contain a maximum set of 10 page links. If fewer pages of results exist, only show page links for the available pages.</li>
<li>When on pages 1-6, the page links should always start at &#8217;1&#8242;.</li>
</ul>
<p><cite><a href="http://developer.yahoo.com/ypatterns/pattern.php?pattern=searchpagination">Search Pagination</a></cite>
</p></blockquote>
<p>The rationale for these rules is also interesting: </p>
<blockquote>
<ul>
<li>Displaying arrow graphics helps differentiate the links and provides larger click targets.</li>
<li>Disabled controls add little value in this context since
<ul>
<li>These links often appear blow the fold.</li>
<li>The first page of results makes up the vast majority of pageviews. Displaying a disabled &#8220;previous&#8221; control on all of these is of little added value.</li>
<li>Although a &#8220;First&#8221; link has value, it competes with the functionality presented in the random-access links. </li>
<li>The &#8220;Last&#8221; link is of little value as the results are sorted by relevance.  This is is also problematic since the total number of results (and therefore, the last result) may not be known. </li>
</ul>
</li>
</ul>
</blockquote>
<h3>Add this pagination style to your search engine</h3>
<p>See the final result on <a href="http://v3ggie.com/">V3GGIE.com</a>: <a href="http://v3ggie.com/recipes/vegetarian+enchiladas.html">Vegetarian Enchiladas Recipes</a></p>
<p>Most <a href="http://php.net/" title="PHP" rel="homepage" class="zem_slink">PHP</a> pagination tutorials assume you are pulling content from a database. <a href="http://ascaniocolonna.com/en/">Ascanio Colonna</a> created a <a href="http://blog.ascaniocolonna.com/?p=12">good tutorial on building pagination</a> with PHP that is agnostic to the data source. I&#8217;ve taken his code and modified it to match the Yahoo Design Pattern. I&#8217;ve also added the suggested <a href="http://developer.yahoo.com/yui/container/module/index.html">YUI Module markup</a> to stay consistent with the <a href="http://developer.yahoo.com/yui/grids/">YUI Grids</a> and any future YUI javascript.</p>
<p>
The pagination.php file includes a function that creates the module. You&#8217;ll need to call this function from your results page with a series of parameters. These are easy to populate from the BOSS interface. It&#8217;s worth noting that I am ignoring the BOSS next/last page nodes in the web service and prefer to build my own urls.</p>
<h3>The Pagination Code</h3>
<p>
Lets&#8217; start by looking at the code inside your results.php file. This will call the pagination function and pass the desired parameters.</p>
<p><code lang="PHP"><br />
if(!empty($searchQuery))<br />
  {<br />
	require '/include/pagination.php';<br />
  if(isset($_REQUEST['page'])) {<br />
	$page = $_REQUEST['page'];<br />
	} else  {<br />
	$page = '1';<br />
	}<br />
	$limit = $count;<br />
	$targetpage = 'results.php';<br />
	$pagestring = '?page=';<br />
	$summary_name = 'articles';<br />
	$placement = 'summary';<br />
	// start pagination<br />
	  echo getPaginationString($page, $totalhits, $limit,  $targetpage, $pagestring, $summary_name, $placement);<br />
 }<br />
</code></p>
<h4>Here&#8217;s what you are working with:</h4>
<dl>
<dt> require &#8216;/include/pagination.php&#8217;</dt>
<dd>Where does the pagination file sit on your server</dd>
<dt>$page logic</dt>
<dd>First look to see if there is page=x in the url. If so, $page = x, if not, you are on page 1.</dd>
<dt>$limit</dt>
<dd>How many results will appear on the page</dd>
<dt>$targetpage</dt>
<dd>what is the name of your results page? index.php, results.php?</dd>
<dt>$pagestring</dt>
<dd>I tried to minimize this to ?p= but couldn&#8217;t track down why it didn&#8217;t work. I&#8217;ve left it at the default ?page=&#8230;</dd>
<dt>$summary_name</dt>
<dd>This is what appears in the text &#8220;xxx (summary_name) results. This is not used in the Yahoo Design Library</dd>
<dt>$placement</dt>
<dd>You&#8217;ll probably want to use summary. This function also allows &#8220;footer&#8221; for a simplified output</dd>
<dt>echo getPaginationString(&#8230;)</dt>
<dd>Send the information to the function and display the results in the page.</dd>
</dl>
<hr />
<h3>Important Update!</h3>
<p>The original code I posted had a serious security flaw. You should never output user&#8217;s input directly into your page. I had something like this href=&#8221;?query=$_REQUEST['query']&#8220;. This allows all sorts of <a href="http://en.wikipedia.org/wiki/Cross-site_scripting" title="Cross-site scripting" rel="wikipedia" class="zem_slink">Cross Site Scripting</a> attacks. You must urlencode any text that comes from a user. This is safe: urlencode($_REQUEST['query']).</p>
<p>I apologize if anyone has used this code, as I wrote it on their site. They should immediately update the logic. -Ted</p>
<hr />
<h3>The pagination function</h3>
<p>
I have streamlined the original code from Asconio, as he was tying into pre-existing facebook styles. This code is for your unique web site. It&#8217;s also worth noting I use rewrite rules to make my search result page urls more friendly, i.e. /corn.html instead of /result.php?q=corn</p>
<p><code lang="PHP"><br />
<?php </p>
<p>//text strings in strings.php</p>
<p>function getPaginationString($page = 1, $totalitems, $limit = 15, $targetpage = '/', $pagestring = '?page=', $summary_name = 'items', $placement = 'summary',$safeQuery)<br />
{</p>
<p>$countnum = '15';</p>
<p>	// inurl or intitle<br />
	// it should only be three digits long, int, inu, or nox anything else could be a vulnerability<br />
	//int=intitle, inu=inurl, nox=no setting<br />
	if (isset($_REQUEST['inx']) &#038;&#038; strlen($_REQUEST['inx']) == 3){<br />
	$inxv = $_REQUEST['inx'];<br />
	}<br />
	else {<br />
	$inxv = '';<br />
	}</p>
<p>	// type of query<br />
	// request type should only be 2 chars, if not we are dealing with an xss attack<br />
	// type options: rc, lo, ve... these represent recipes, local, buzz for insider sites.<br />
	if (!empty($_REQUEST['t']) &#038;&#038; strlen($_REQUEST['t']) <= 2) {<br />
		$tid = $_REQUEST['t'];<br />
	}<br />
	else{<br />
	$tid = 've';}<br />
// count should only be a number. don't allow text for xss protection<br />
if (!empty($_REQUEST['count'])) {<br />
	$countnum = number($_REQUEST['count']);<br />
	$limit = $countnum;<br />
}<br />
	// DEFAULTS<br />
	$adjacents = 10;<br />
	//$targetpage = .'.html';<br />
	// VARS<br />
	if(substr($pagestring, 0, 1) != '?') $pagestring = '?' . $pagestring; // If query string is lacking start, add it<br />
	if(substr($pagestring, strlen($pagestring) - 5) != 'page=') $pagestring .= '&#038;page='; // If query string is lacking page var, add it<br />
	$prev = $page - 1;<br />
	$next = $page + 1;<br />
	$firstpage = 1;<br />
	$lastpage = ceil($totalitems / $limit);<br />
	$fiop = ($limit * $page) - $limit + 1; //# of first item displayed in current page<br />
	$liop = min($limit * $page, $totalitems); //# of last item displayed in current page<br />
	$searchstring = "&amp;t=$tid&amp;inx=$inxv";<br />
	$nicetotal = number_format($totalitems);</p>
<p>	/*<br />
		DRAW PAGINATOR<br />
	*/</p>
<p>	// Give it the right class (the footer paginator has no summary and the current page has a different gfx)<br />
	if($placement == 'summary')<br />
		$type = 'summary';<br />
	else<br />
		$type = 'footer';</p>
<p>	// Draw summary<br />
	if($placement == 'summary')<br />
		$pagination .= "
<div class=\"summary hd\">
<h4>$string_results_page</h4>
</div>
<p>";</p>
<p>	if($lastpage > 1) // Paginator page selection is drawn only if more than 1 pages are there<br />
	{	</p>
<p>		$pagination .= '
<div class="bd">
<ul>';</p>
<p>		// First page selector<br />
		if ($page > 2) </p>
<p>		// Previous page selector<br />
		if ($page > 1)<br />
			$pagination .= "
<li class=\"prevlink\"><a href=\"$safeQuery.html$pagestring$prev$searchstring\">$string_next</a></li>
<p>";	</p>
<p>		// Page selectors<br />
		if ($page < 4)	//not enough pages to bother<br />
		{<br />
			for ($counter = 1; $counter <= min(5, $lastpage); $counter++)<br />
			{<br />
				if ($counter == $page)<br />
					$pagination .= "
<li class=\"current\"><strong>$counter</strong></li>
<p>";<br />
				else<br />
					$pagination .= "
<li><a href=\"$safeQuery.html$pagestring$counter$searchstring\">$counter</a></li>
<p>";<br />
			}<br />
		}<br />
		elseif ($page > $lastpage - 3)<br />
		{<br />
			for($counter = $lastpage - min(5, $lastpage); $counter <= $lastpage; $counter++)<br />
			{<br />
				if ($counter == $page)<br />
					$pagination .= "
<li class=\"current\"><strong>$counter</strong></li>
<p>";<br />
				else<br />
					$pagination .= "
<li><a href=\"$safeQuery.html$pagestring$counter$searchstring\">$counter</a></li>
<p>";<br />
			}<br />
		}<br />
		else<br />
		{<br />
			for($counter = $page - 2; $counter <= $page + 2; $counter++)<br />
			{<br />
				if ($counter == $page)<br />
					$pagination .= "
<li class=\"current\"><strong>$counter</strong></li>
<p>";<br />
				else<br />
					$pagination .= "
<li><a href=\"$safeQuery.html$pagestring$counter$searchstring\">$counter</a></li>
<p>";<br />
			}<br />
		}</p>
<p>		//next button<br />
		if ($page < $lastpage)<br />
			$pagination .= "
<li class=\"nextlink\"><a href=\"$safeQuery.html$pagestring$next$searchstring\">$string_next</a></li>
<p>";</p>
<p>		//last button<br />
		if ($page < $lastpage - 1) </p>
<p>		$pagination .= '</ul>
</div>
<p>';<br />
	}</p>
<p>	$pagination = "
<div class=\"pagelinks \">$pagination</div>
<p>";</p>
<p>	return $pagination;</p>
<p>} ?></p>
<p><?php</p>
<p>//This allows user to easily try the search with different options</p>
<p>// strings are translated defined in separate file for localization<br />
//$string_try_diff_type   = "Try a different type of search";<br />
//$string_try_diff_header = "Didn't find what you were looking for?";<br />
//$string_try_inx         = "Try searching for $safeQuery only in page titles";</p>
<p>function trySomethingelse($safeQuery, $searchQuery, $inx, $tid,$string_try_diff_header, $string_try_diff_type, $string_try_inx, $string_buzz_tab, $string_local_tab,$string_recipes_tab){<br />
if($inx==''){<br />
$tryinx = "
<li><a href=\"/$safeQuery.html?inx=int\">$string_try_inx</a>";<br />
}<br />
$trydiff='';<br />
switch ($tid){<br />
case "rc":<br />
$trydiff = "</p>
<li>$string_try_diff_type <a href=\"/$safeQuery.html?t=lo\">$string_local_tab</a> or<br />
<a href=\"/$safeQuery.html?t=ve\">$string_buzz_tab</a>";<br />
break;<br />
case "lo":<br />
$trydiff = "</p>
<li>$string_try_diff_type <a href=\"/$safeQuery.html?t=rc\">$string_recipes_tab</a> or<br />
<a href=\"/$safeQuery.html?t=ve\">$string_buzz_tab</a>";<br />
break;<br />
default:<br />
$trydiff = "</p>
<li>$string_try_diff_type <a href=\"/$safeQuery.html?t=rc\">$string_recipes_tab</a> or<br />
<a href=\"/$safeQuery.html?t=lo\">$string_local_tab</a>";<br />
}</p>
<p>?></p>
<div class="different mod">
<div class="hd"><?php print $string_try_diff_header ;?></div>
<div class="bd">
<ul>
<?php<br />
print 	$tryinx;<br />
print  	$trydiff;<br />
?></p>
</ul>
</div>
</div>
<p><?php<br />
}<br />
?></p>
<p></code></p>
<p>
I&#8217;ve added a few classes to the final output. The previous and next links have class&#8221;nextlink&#8221; or class=&#8221;prevlink&#8221;. The current page has the number within a strong tag with class=&#8221;current&#8221;. Finally, the parent module has class=&#8221;pagelinks mod&#8221;. This makes it pretty simple to style</p>
<h4>Pagination CSS</h4>
<p>I&#8217;m using the YUI Sam Skin sprite for the tabbed search box. I&#8217;ve added a couple arrows to this sprite for my search pagination. </p>
<p><code lang="CSS"><br />
.pagelinks {<br />
text-align:center;<br />
border:1px solid #ccc;<br />
padding:5px 0 0 0;<br />
}<br />
.pagelinks ul li {<br />
display:inline;<br />
}<br />
.pagelinks ul a, .pagelinks ul strong {<br />
display;block; padding:3px 5px;<br />
}<br />
.pagelinks ul strong {<br />
background-color:green; color:#fff;<br />
}<br />
.pagelinks li.nextlink a,.pagelinks li.prevlink a  {<br />
padding-right:15px; font-size:120%; font-wieght:bold; background:url(/images/sprite.png) no-repeat 100% -1943px;<br />
}<br />
.pagelinks li.prevlink a {<br />
padding-right:0px; padding-left:15px; background-position:0 -1973px;<br />
}<br />
</code></p>
<p>
I am also not a PHP expert and welcome suggestions on improving the code.</p>
<h3>Download files</h3>
<ul>
<li><a href="http://www.last-child.com/pagination.txt">Pagination functionality for a BOSS site (.txt)</a> &#8211; the php code and sample to insert the pagination.</li>
</ul>
<h3>Related articles by Zemanta</h3>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://chris.pirillo.com/2008/09/11/are-you-tired-of-the-same-old-search-engine/">Are You Tired of the Same Old Search Engine?</a></li>
<li class="zemanta-article-ul-li"><a href="http://lifehacker.com/5046701/buildasearch-combines-multiple-site-seaches-into-one-box">Buildasearch Combines Multiple Site Seaches into One Box [Search]</a></li>
<li class="zemanta-article-ul-li"><a href="http://www.last-child.com/create-search-yahoo-boss/">Create your own Search Engine with Yahoo! BOSS</a></li>
<li class="zemanta-article-ul-li"><a href="http://blog.programmableweb.com/2008/09/11/5-best-practices-for-mashups/">5 Best Practices for Mashups</a></li>
<li class="zemanta-article-ul-li"><a href="http://blog.programmableweb.com/2008/09/11/5-best-practices-for-mashups/">5 Best Practices for Mashups</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.last-child.com/pagination-boss-search-engine/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Background image for visited links</title>
		<link>http://www.last-child.com/background-image-for-visited-links/</link>
		<comments>http://www.last-child.com/background-image-for-visited-links/#comments</comments>
		<pubDate>Fri, 07 Apr 2006 02:42:46 +0000</pubDate>
		<dc:creator>Ted</dc:creator>
				<category><![CDATA[:absolute]]></category>
		<category><![CDATA[:relative]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML Elements]]></category>
		<category><![CDATA[Id]]></category>
		<category><![CDATA[Image]]></category>
		<category><![CDATA[Image Sprites]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Link]]></category>
		<category><![CDATA[Unordered List]]></category>
		<category><![CDATA[Z-Index]]></category>
		<category><![CDATA[position]]></category>

		<guid isPermaLink="false">http://www.last-child.com/background-image-for-visited-links/</guid>
		<description><![CDATA[I&#8217;ve been a recent convert to Design Meltdown. The site disects a visual theme and gives examples on how to use them and where they are being used. While exploring the latest post about sketches for the web, I noticed an interesting approach to the visited pages. The Breakdown The site has a series of [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.last-child.com/wp-content/uploads/2006/04/dmelt-visited.png" alt="Visited and unvisited screenshots on designmeltdown.com" /><br />
I&#8217;ve been a recent convert to <a href="http://www.designmeltdown.com/">Design Meltdown</a>. The site disects a visual theme and gives examples on how to use them and where they are being used. While exploring the latest post about <a href="http://www.designmeltdown.com/chapters/Sketchy/">sketches for the web</a>, I noticed an interesting approach to the visited pages.</p>
<h3>The Breakdown</h3>
<p>The site has a series of floated divs to display the screenshots. The screenshot is applied as the background image of the div with an inline style.  Inside the div is a link that is given display:block and a transparent background image.<br />
<code lang="HTML"></p>
<div webdeveloper-inline-style="background-image: url(http://www.designmeltdown.com/chapters/Sketchy/1/145_115/57982515.jpg);" class="RedXContainer">
<a id="_ctl6_lnkImage" title="http://www.outhousecomm.com/home.html" class="RedXLink" href="http://www.outhousecomm.com/home.html" target="_blank"></a><br />
<a id="_ctl6_lnkScreenShot" title="View a captured screen shot" class="RedXScreenShot" href="javascript:popUp('http://www.designmeltdown.com/displaySS.html?<br />
http://www.designmeltdown.com/chapters/Sketchy/1/445/57982515.jpg')">SCREENSHOT</a>
</div>
<p></code></p>
<h3>Great idea &#8211; room for improvement?</h3>
<p>While I think the visual design for these screenshots is well thought-out. I don&#8217;t like the underlying code. The screenshots are content; miniature representations of other sites. Adding them to the CSS is treating them as decorative elements. The text for each link is: &#8220;SCREENSHOT, &#8221; making the page unusable with the styles disabled. To give this page more structure and semantic strength, I would modify the underlying code as such:</p>
<h4>HTML Code</h4>
<p><code lang="HTML"></p>
<div id="screenshotthumbs">
<ul class="screenshotlist">
<li id="ss_ctl6_lnk">
<a href="http://www.outhousecomm.com/home.html" title="This link will open a new window for you to see outhouse.com" rel="external"><br />
<img src="http://www.designmeltdown.com/chapters/Sketchy/1/145_115/57982515.jpg" alt="www.outhousecomm.com screenshot"/><br />
<strong>Visit www.outhousecomm.com to see how they've used this technique</strong><br />
</a>
</li>
<p>...
</ul>
</div>
<p></code></p>
<h4>CSS Code</h4>
<p><code lang="CSS"><br />
.screenshotlist {float:left; list-style-type:none;}<br />
.screenshotlist li {float:left; margin:9px; }<br />
.screenshotlist a {display:block; width:146px; height:130px; position:relative; }<br />
.screenshotlist a strong {text-indent:-1000em; z-index:20; position: absolute; top:0; left:0; width:100%; height:100%; background:url(screenshot.png) no-repeat -154px 0; }<br />
.screenshotlist a:visited strong {background-position:0 0;}<br />
.screenshotlist a img {margin:5px 0 0 5px; border:none; z-index:1;}<br />
</code></p>
<h3>Benefits of the new code</h3>
<p><img src="http://www.last-child.com/wp-content/uploads/2006/04/screenshot.png" alt="screenshot mask" /><br />
The screenshots now have some structure; an unordered list with links full of good, crunchy content. Screenreaders and those without CSS will have access to the information. Javascript can be used to target links within the screenshotthumb div to <a href="http://www.last-child.com/should-a-web-site-open-pdf-files-in-a-new-window/">open  a new window without the need of inline scripting</a>. </p>
<p><strong>Cavaets: </strong>I haven&#8217;t tested this code yet. It&#8217;s very possible the z-index styles are not required. As an alternative, remove the margin on the image and replace it with a border. Add a rule to change the border color on hover and visited. </p>
<p>Design Meltdown is a great site for learning about design concepts. I&#8217;ve gleaned a number of nice ideas from them and would love to say I gave a bit of help back to them. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.last-child.com/background-image-for-visited-links/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
