/    Sign up×
Community /Pin to ProfileBookmark

implement a function sort horizontal in php

How can I implement the below example wherein the desired results would be like this in php format

Text

text | text | text | text | text | More…

Text2

text | text | text | text | text | More…

Text 3

text | text | text | text | text | More…

Note: Only the first five words will be visible with the More link as the sixth. All text will be clickable as links.

thanks

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@bokehSep 15.2007 — in php format[/QUOTE]???
All text will be clickable as links.[/QUOTE]What do you mean?
Copy linkTweet thisAlerts:
@Kostas_ZotosSep 16.2007 — Hello,

@bokeh: I think URL links separated by the pipe "|" sumbol (like the ones in your signature)

eg: Home| SiteMap | News | Contact etc..

An example php script that automatically creates the following links:

[COLOR="Blue"]Visit Home [/COLOR]| [COLOR="Blue"]View SiteMap[/COLOR] | [COLOR="Blue"]Read News[/COLOR] | [COLOR="Blue"]Contact Us[/COLOR]

[code=php]<?php

//Set your site
$Domain="http://www.yoursite.com/";

//The locations or files in your site
$URIs=array("Home/", "SiteMap.html" , "News/", "Contact.php");

//The visible link-names in your html (or php) doc. What should be between <a href=..> and </a>
$URLS_Descriptions=array("Visit Home", "View SiteMap", "Read News", "Contuct Us");

$Output="";

for ($i=0;$i<count($URIs);$i++) {
$Delimiter=($i<count($URIs)-1)?" | ":""; // The visible separator (here is the "|") of your links.
$Output.='<a href="' .$Domain.$URIs[$i]. '" target="_self" title=" Click to '.$URLS_Descriptions[$i].' ">'.$URLS_Descriptions[$i].'</a> '."n".$Delimiter;
}

echo $Output."n<br><br>n"; //Print the total string (and a couple of newlines)

?>[/code]


Kostas
Copy linkTweet thisAlerts:
@Kostas_ZotosSep 18.2007 — A bit different code (one array is used to store the link-path couples) used to "auto create" the working links shown in the previous post [you can add more, remove or replace the names (links) and destinations (paths) to reflect your needs]:

[code=php]<?php
//Set your site
$Domain="http://www.yoursite.com/";

//An associative array of links and their (relative paths) locations or files

$URLs=array("Visit Home" => "Home/", "View SiteMap" => "SiteMap.html", "Read News" => "News/", "Contact Us" => "Contact.php");

$Output="";
$Counter=0;

foreach ($URLs as $Link => $URI) {
$Counter++;
$Delimiter=($Counter<count($URLs))?" | ":""; // The visible separator (here is the "|") of your links.
$Output.='<a href="' .$Domain.$URI. '" target="_self" title=" Click to '.$Link.' ">'.$Link.'</a> '."n".$Delimiter;
}

echo $Output."n<br><br>n"; //Print the total string (and a couple of newlines)
?>[/code]

The script automatically creates the following links (below links are not active here):

[COLOR="Blue"]Visit Home[/COLOR] | [COLOR="Blue"]View SiteMap[/COLOR] | [COLOR="Blue"]Read News[/COLOR] | [COLOR="Blue"]Contact Us[/COLOR]

Kostas
Copy linkTweet thisAlerts:
@eyeshield21authorSep 18.2007 — thanks for the response Kostas Zotos it really helps me, now what if the out put

is like this:

eg:

Cat

subcat | subcat2 | subcat3 | subcat4| subcat5
×

Success!

Help @eyeshield21 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...