Encerrado

Convert script into google like pagination

I have this RSS parsing code and it paginates , but only uses 'next' and 'previous' links instead of how google does it. I want it to read like this: first 1 2 3.... last

I want it to look like this: [url removed, login to view]

## Deliverables

I have this RSS parsing code and it paginates , but only uses 'next' and 'previous' links instead of how google does it. I want it to read like this: first 1 2 3.... last

I want it to look like this: [url removed, login to view]

<code><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 187);"><?php <br /></span><span style="color: rgb(0, 119, 0);">require_once(</span><span style="color: rgb(221, 0, 0);">'[url removed, login to view]'</span><span style="color: rgb(0, 119, 0);">); <br /> <br /></span><span style="color: rgb(255, 128, 0);">// Set your own configuration options as you see fit. <br /></span><span style="color: rgb(0, 0, 187);">$feed </span><span style="color: rgb(0, 119, 0);">= new </span><span style="color: rgb(0, 0, 187);">SimplePie</span><span style="color: rgb(0, 119, 0);">(); <br /></span><span style="color: rgb(0, 0, 187);">$feed</span><span style="color: rgb(0, 119, 0);">-></span><span style="color: rgb(0, 0, 187);">set_feed_url</span><span style="color: rgb(0, 119, 0);">(array( <br /></span><span style="color: rgb(0, 0, 187);">link1 <br />link2 <br /></span><span style="color: rgb(0, 119, 0);">..... <br />)); <br /></span><span style="color: rgb(0, 0, 187);">$success </span><span style="color: rgb(0, 119, 0);">= </span><span style="color: rgb(0, 0, 187);">$feed</span><span style="color: rgb(0, 119, 0);">-></span><span style="color: rgb(0, 0, 187);">init</span><span style="color: rgb(0, 119, 0);">(); <br /> <br /> <br /> <br /></span><span style="color: rgb(255, 128, 0);">// Make sure the page is being served with the right headers. <br /></span><span style="color: rgb(0, 0, 187);">$feed</span><span style="color: rgb(0, 119, 0);">-></span><span style="color: rgb(0, 0, 187);">handle_content_type</span><span style="color: rgb(0, 119, 0);">(); <br /> <br /></span><span style="color: rgb(255, 128, 0);">// Set our paging values <br /></span><span style="color: rgb(0, 0, 187);">$start </span><span style="color: rgb(0, 119, 0);">= (isset(</span><span style="color: rgb(0, 0, 187);">$_GET</span><span style="color: rgb(0, 119, 0);">[</span><span style="color: rgb(221, 0, 0);">'start'</span><span style="color: rgb(0, 119, 0);">]) && !empty(</span><span style="color: rgb(0, 0, 187);">$_GET</span><span style="color: rgb(0, 119, 0);">[</span><span style="color: rgb(221, 0, 0);">'start'</span><span style="color: rgb(0, 119, 0);">])) ? </span><span style="color: rgb(0, 0, 187);">$_GET</span><span style="color: rgb(0, 119, 0);">[</span><span style="color: rgb(221, 0, 0);">'start'</span><span style="color: rgb(0, 119, 0);">] : </span><span style="color: rgb(0, 0, 187);">0</span><span style="color: rgb(0, 119, 0);">; </span><span style="color: rgb(255, 128, 0);">// Where do we start? <br /></span><span style="color: rgb(0, 0, 187);">$length </span><span style="color: rgb(0, 119, 0);">= (isset(</span><span style="color: rgb(0, 0, 187);">$_GET</span><span style="color: rgb(0, 119, 0);">[</span><span style="color: rgb(221, 0, 0);">'length'</span><span style="color: rgb(0, 119, 0);">]) && !empty(</span><span style="color: rgb(0, 0, 187);">$_GET</span><span style="color: rgb(0, 119, 0);">[</span><span style="color: rgb(221, 0, 0);">'length'</span><span style="color: rgb(0, 119, 0);">])) ? </span><span style="color: rgb(0, 0, 187);">$_GET</span><span style="color: rgb(0, 119, 0);">[</span><span style="color: rgb(221, 0, 0);">'length'</span><span style="color: rgb(0, 119, 0);">] : </span><span style="color: rgb(0, 0, 187);">5</span><span style="color: rgb(0, 119, 0);">; </span><span style="color: rgb(255, 128, 0);">// How many per page? <br /></span><span style="color: rgb(0, 0, 187);">$max </span><span style="color: rgb(0, 119, 0);">= </span><span style="color: rgb(0, 0, 187);">$feed</span><span style="color: rgb(0, 119, 0);">-></span><span style="color: rgb(0, 0, 187);">get_item_quantity</span><span style="color: rgb(0, 119, 0);">(); </span><span style="color: rgb(255, 128, 0);">// Where do we end? <br /> <br />// When we end our PHP block, we want to make sure our DOCTYPE is on the top line to make <br />// sure that the browser snaps into Standards Mode. <br /></span><span style="color: rgb(0, 0, 187);">?></span><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "\"> <br /> <br /><html xmlns="" xml:lang="en-US" lang="en-US"> <br /><head> <br /><title>SimplePie: Demo</title> <br /> <br /><link rel="stylesheet" href="[url removed, login to view]" type="text/css" media="screen, projector" /> <br /> <br /></head> <br /> <br /><body> <br /><div id="site"> <br /><span style="color: rgb(0, 0, 187);"><?php <br /></span><span style="color: rgb(255, 128, 0);">// If we have an error, display it. <br /></span><span style="color: rgb(0, 119, 0);">if (</span><span style="color: rgb(0, 0, 187);">$feed</span><span style="color: rgb(0, 119, 0);">-></span><span style="color: rgb(0, 0, 187);">error</span><span style="color: rgb(0, 119, 0);">()) <br />{ <br />echo </span><span style="color: rgb(221, 0, 0);">'<div class="sp_errors">' </span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(221, 0, 0);">"\r\n"</span><span style="color: rgb(0, 119, 0);">; <br />echo </span><span style="color: rgb(221, 0, 0);">'<p>' </span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(0, 0, 187);">htmlspecialchars</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(0, 0, 187);">$feed</span><span style="color: rgb(0, 119, 0);">-></span><span style="color: rgb(0, 0, 187);">error</span><span style="color: rgb(0, 119, 0);">()) . </span><span style="color: rgb(221, 0, 0);">"</p>\r\n"</span><span style="color: rgb(0, 119, 0);">; <br />echo </span><span style="color: rgb(221, 0, 0);">'</div>' </span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(221, 0, 0);">"\r\n"</span><span style="color: rgb(0, 119, 0);">; <br />} <br /></span><span style="color: rgb(0, 0, 187);">?> <br /></span> <br /><span style="color: rgb(0, 0, 187);"><?php </span><span style="color: rgb(0, 119, 0);">if (</span><span style="color: rgb(0, 0, 187);">$success</span><span style="color: rgb(0, 119, 0);">): </span><span style="color: rgb(0, 0, 187);">?> <br /><?php <br /></span><span style="color: rgb(255, 128, 0);">// get_items() will accept values from above. <br /></span><span style="color: rgb(0, 119, 0);">foreach(</span><span style="color: rgb(0, 0, 187);">$feed</span><span style="color: rgb(0, 119, 0);">-></span><span style="color: rgb(0, 0, 187);">get_items</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(0, 0, 187);">$start</span><span style="color: rgb(0, 119, 0);">, </span><span style="color: rgb(0, 0, 187);">$length</span><span style="color: rgb(0, 119, 0);">) as </span><span style="color: rgb(0, 0, 187);">$item</span><span style="color: rgb(0, 119, 0);">): <br /></span><span style="color: rgb(0, 0, 187);">$feed </span><span style="color: rgb(0, 119, 0);">= </span><span style="color: rgb(0, 0, 187);">$item</span><span style="color: rgb(0, 119, 0);">-></span><span style="color: rgb(0, 0, 187);">get_feed</span><span style="color: rgb(0, 119, 0);">(); <br /></span><span style="color: rgb(0, 0, 187);">?> <br /></span> <br /><div class="chunk"> <br /> <br /><h4><span style="color: rgb(0, 0, 187);"><?php </span><span style="color: rgb(0, 119, 0);">if (</span><span style="color: rgb(0, 0, 187);">$item</span><span style="color: rgb(0, 119, 0);">-></span><span style="color: rgb(0, 0, 187);">get_permalink</span><span style="color: rgb(0, 119, 0);">()) echo </span><span style="color: rgb(221, 0, 0);">'<a href="' </span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(0, 0, 187);">$item</span><span style="color: rgb(0, 119, 0);">-></span><span style="color: rgb(0, 0, 187);">get_permalink</span><span style="color: rgb(0, 119, 0);">() . </span><span style="color: rgb(221, 0, 0);">'">'</span><span style="color: rgb(0, 119, 0);">; echo </span><span style="color: rgb(0, 0, 187);">$item</span><span style="color: rgb(0, 119, 0);">-></span><span style="color: rgb(0, 0, 187);">get_title</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(0, 0, 187);">true</span><span style="color: rgb(0, 119, 0);">); if (</span><span style="color: rgb(0, 0, 187);">$item</span><span style="color: rgb(0, 119, 0);">-></span><span style="color: rgb(0, 0, 187);">get_permalink</span><span style="color: rgb(0, 119, 0);">()) echo </span><span style="color: rgb(221, 0, 0);">'</a>'</span><span style="color: rgb(0, 119, 0);">; </span><span style="color: rgb(0, 0, 187);">?></span></h4> <br /> <br /><p class="footnote">Source: <a href="<span style="color: rgb(0, 0, 187);"><?php </span><span style="color: rgb(0, 119, 0);">echo </span><span style="color: rgb(0, 0, 187);">$feed</span><span style="color: rgb(0, 119, 0);">-></span><span style="color: rgb(0, 0, 187);">get_permalink</span><span style="color: rgb(0, 119, 0);">(); </span><span style="color: rgb(0, 0, 187);">?></span>"><span style="color: rgb(0, 0, 187);"><?php </span><span style="color: rgb(0, 119, 0);">echo </span><span style="color: rgb(0, 0, 187);">$feed</span><span style="color: rgb(0, 119, 0);">-></span><span style="color: rgb(0, 0, 187);">get_title</span><span style="color: rgb(0, 119, 0);">(); </span><span style="color: rgb(0, 0, 187);">?></span></a> | <span style="color: rgb(0, 0, 187);"><?putenv</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">"TZ=US/Pacific"</span><span style="color: rgb(0, 119, 0);">); echo </span><span style="color: rgb(0, 0, 187);">$item</span><span style="color: rgb(0, 119, 0);">-></span><span style="color: rgb(0, 0, 187);">get_date</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'j M Y | g:i a'</span><span style="color: rgb(0, 119, 0);">); </span><span style="color: rgb(0, 0, 187);">?></span></p> <br /> <br /></div> <br /> <br /><span style="color: rgb(0, 0, 187);"><?php </span><span style="color: rgb(0, 119, 0);">endforeach; </span><span style="color: rgb(0, 0, 187);">?> <br /><?php </span><span style="color: rgb(0, 119, 0);">endif; </span><span style="color: rgb(0, 0, 187);">?> <br /></span> <br /><span style="color: rgb(0, 0, 187);"><?php <br /></span><span style="color: rgb(255, 128, 0);">// Let's do our paging controls <br /></span><span style="color: rgb(0, 0, 187);">$next </span><span style="color: rgb(0, 119, 0);">= (int) </span><span style="color: rgb(0, 0, 187);">$start </span><span style="color: rgb(0, 119, 0);">+ (int) </span><span style="color: rgb(0, 0, 187);">$length</span><span style="color: rgb(0, 119, 0);">; <br /></span><span style="color: rgb(0, 0, 187);">$prev </span><span style="color: rgb(0, 119, 0);">= (int) </span><span style="color: rgb(0, 0, 187);">$start </span><span style="color: rgb(0, 119, 0);">- (int) </span><span style="color: rgb(0, 0, 187);">$length</span><span style="color: rgb(0, 119, 0);">; <br /> <br /></span><span style="color: rgb(255, 128, 0);">// Create the NEXT link <br /></span><span style="color: rgb(0, 0, 187);">$nextlink </span><span style="color: rgb(0, 119, 0);">= </span><span style="color: rgb(221, 0, 0);">'<a href="?start=' </span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(0, 0, 187);">$next </span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(221, 0, 0);">'&length=' </span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(0, 0, 187);">$length </span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(221, 0, 0);">'">Next &raquo;</a>'</span><span style="color: rgb(0, 119, 0);">; <br />if (</span><span style="color: rgb(0, 0, 187);">$next </span><span style="color: rgb(0, 119, 0);">> </span><span style="color: rgb(0, 0, 187);">$max</span><span style="color: rgb(0, 119, 0);">) <br />{ <br /></span><span style="color: rgb(0, 0, 187);">$nextlink </span><span style="color: rgb(0, 119, 0);">= </span><span style="color: rgb(221, 0, 0);">'Next &raquo;'</span><span style="color: rgb(0, 119, 0);">; <br />} <br /> <br /></span><span style="color: rgb(255, 128, 0);">// Create the PREVIOUS link <br /></span><span style="color: rgb(0, 0, 187);">$prevlink </span><span style="color: rgb(0, 119, 0);">= </span><span style="color: rgb(221, 0, 0);">'<a href="?start=' </span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(0, 0, 187);">$prev </span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(221, 0, 0);">'&length=' </span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(0, 0, 187);">$length </span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(221, 0, 0);">'">&laquo; Previous</a>'</span><span style="color: rgb(0, 119, 0);">; <br />if (</span><span style="color: rgb(0, 0, 187);">$prev </span><span style="color: rgb(0, 119, 0);">< </span><span style="color: rgb(0, 0, 187);">0 </span><span style="color: rgb(0, 119, 0);">&& (int) </span><span style="color: rgb(0, 0, 187);">$start </span><span style="color: rgb(0, 119, 0);">> </span><span style="color: rgb(0, 0, 187);">0</span><span style="color: rgb(0, 119, 0);">) <br />{ <br /></span><span style="color: rgb(0, 0, 187);">$prevlink </span><span style="color: rgb(0, 119, 0);">= </span><span style="color: rgb(221, 0, 0);">'<a href="?start=0&length=' </span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(0, 0, 187);">$length </span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(221, 0, 0);">'">&laquo; Previous</a>'</span><span style="color: rgb(0, 119, 0);">; <br />} <br />else if (</span><span style="color: rgb(0, 0, 187);">$prev </span><span style="color: rgb(0, 119, 0);">< </span><span style="color: rgb(0, 0, 187);">0</span><span style="color: rgb(0, 119, 0);">) <br />{ <br /></span><span style="color: rgb(0, 0, 187);">$prevlink </span><span style="color: rgb(0, 119, 0);">= </span><span style="color: rgb(221, 0, 0);">'&laquo; Previous'</span><span style="color: rgb(0, 119, 0);">; <br />} <br /> <br /></span><span style="color: rgb(255, 128, 0);">// Normalize the numbering for humans <br /></span><span style="color: rgb(0, 0, 187);">$begin </span><span style="color: rgb(0, 119, 0);">= (int) </span><span style="color: rgb(0, 0, 187);">$start </span><span style="color: rgb(0, 119, 0);">+ </span><span style="color: rgb(0, 0, 187);">1</span><span style="color: rgb(0, 119, 0);">; <br /></span><span style="color: rgb(0, 0, 187);">$end </span><span style="color: rgb(0, 119, 0);">= (</span><span style="color: rgb(0, 0, 187);">$next </span><span style="color: rgb(0, 119, 0);">> </span><span style="color: rgb(0, 0, 187);">$max</span><span style="color: rgb(0, 119, 0);">) ? </span><span style="color: rgb(0, 0, 187);">$max </span><span style="color: rgb(0, 119, 0);">: </span><span style="color: rgb(0, 0, 187);">$next</span><span style="color: rgb(0, 119, 0);">; <br /></span><span style="color: rgb(0, 0, 187);">?> <br /></span> <br /><p>Showing <span style="color: rgb(0, 0, 187);"><?php </span><span style="color: rgb(0, 119, 0);">echo </span><span style="color: rgb(0, 0, 187);">$begin</span><span style="color: rgb(0, 119, 0);">; </span><span style="color: rgb(0, 0, 187);">?></span>&ndash;<span style="color: rgb(0, 0, 187);"><?php </span><span style="color: rgb(0, 119, 0);">echo </span><span style="color: rgb(0, 0, 187);">$end</span><span style="color: rgb(0, 119, 0);">; </span><span style="color: rgb(0, 0, 187);">?></span> out of <span style="color: rgb(0, 0, 187);"><?php </span><span style="color: rgb(0, 119, 0);">echo </span><span style="color: rgb(0, 0, 187);">$max</span><span style="color: rgb(0, 119, 0);">; </span><span style="color: rgb(0, 0, 187);">?></span> | <span style="color: rgb(0, 0, 187);"><?php </span><span style="color: rgb(0, 119, 0);">echo </span><span style="color: rgb(0, 0, 187);">$prevlink</span><span style="color: rgb(0, 119, 0);">; </span><span style="color: rgb(0, 0, 187);">?></span> | <span style="color: rgb(0, 0, 187);"><?php </span><span style="color: rgb(0, 119, 0);">echo </span><span style="color: rgb(0, 0, 187);">$nextlink</span><span style="color: rgb(0, 119, 0);">; </span><span style="color: rgb(0, 0, 187);">?></span> | <a href="<span style="color: rgb(0, 0, 187);"><?php </span><span style="color: rgb(0, 119, 0);">echo </span><span style="color: rgb(221, 0, 0);">'?start=' </span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(0, 0, 187);">$start </span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(221, 0, 0);">'&length=5'</span><span style="color: rgb(0, 119, 0);">; </span><span style="color: rgb(0, 0, 187);">?></span>">5</a>, <a href="<span style="color: rgb(0, 0, 187);"><?php </span><span style="color: rgb(0, 119, 0);">echo </span><span style="color: rgb(221, 0, 0);">'?start=' </span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(0, 0, 187);">$start </span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(221, 0, 0);">'&length=10'</span><span style="color: rgb(0, 119, 0);">; </span><span style="color: rgb(0, 0, 187);">?></span>">10</a>, or <a href="<span style="color: rgb(0, 0, 187);"><?php </span><span style="color: rgb(0, 119, 0);">echo </span><span style="color: rgb(221, 0, 0);">'?start=' </span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(0, 0, 187);">$start </span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(221, 0, 0);">'&length=20'</span><span style="color: rgb(0, 119, 0);">; </span><span style="color: rgb(0, 0, 187);">?></span>">20</a> at a time.</p> <br /></div> <br /> <br /></body> <br /></html></span></code>

Habilidades: PHP

Ver mais: style your head, standards for success, pacific source, inc top, html 5 doctype, dynamic p, doctype html public html 5, create your own php style, php end script, max p, doctype html 5, xml php array, xml dtd, PROJECTOR, prev, php google style, script head http, div screen, php text array, convert line, convert links html php, php head script, php parsing text, div style top, xmlns

Acerca do Empregador:
( 17 comentários )

ID do Projeto: #2972446

10 freelancers are bidding on average $62 for this job

sunilexpert

See private message.

$29.75 USD in 4 dias
(66 Comentários)
5.8
vnscript

See private message.

$42.5 USD in 4 dias
(86 Comentários)
5.4
robweb2009

See private message.

$17 USD in 4 dias
(88 Comentários)
5.0
webdeveloperro

See private message.

$63.75 USD in 4 dias
(16 Comentários)
4.0
gabusingh

See private message.

$34 USD in 4 dias
(20 Comentários)
3.9
zorangasic

See private message.

$21.25 USD in 4 dias
(11 Comentários)
2.8
creativeprovider

See private message.

$17 USD in 4 dias
(4 Comentários)
2.1
freelancer043

See private message.

$11.05 USD in 4 dias
(1 Comentário)
0.7
webdeveloper01vw

See private message.

$42.5 USD in 4 dias
(0 Comentários)
0.0
abdulcoder

See private message.

$297.5 USD in 4 dias
(0 Comentários)
0.0
rajeshagrawalvw

See private message.

$59.5 USD in 4 dias
(0 Comentários)
0.0