Welcome, Guest: Join Nairaland / LOGIN! / Trending / Recent / New
Stats: 2,714,132 members, 6,412,860 topics. Date: Friday, 30 July 2021 at 03:27 PM

Page Search - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Page Search (512 Views)

On Page Search Engine Optimizations – Best Tips / On-page And Off-page Search Engine Optimization (2) (3) (4)

(1) (Reply) (Go Down)

Page Search by Nobody: 5:27am On Sep 23, 2012
Hi guys,

I need some help here. Am trying to create a sort search feature list pages in alphabetical order similar to the image attached (see attachment). How can i do that using CSS.

Thanks all.

Re: Page Search by yawatide(f): 5:14pm On Sep 23, 2012
You are going to need to use a back end language (PHP, JSP, Ruby on Rails, etc) for this, but I am sure you already knew that. Of course you could do this in HTML but trust me, the maintenance factor will be hell.

To get this done (at least this is how I would do it. Not to say it's the best approach. Others, feel free to chime in), you will need to:
1) Write a fxn that runs a query for the occurrence of each letter you have there
2) Return a boolean for the result (true if count is > 1. false otherwise)
3) Run this fxn against each printed letter. If result is true, add, say, a CLASS name to the element enclosing each letter. Else, do nothing. You could use the ternary operator for simplicity, like so: <a href="#"<?php echo ($isCount()) ? " class='active'" : ""; ?>>A</a>

Note:
1) My code isn't guaranteed to work - I haven't run it. What you see is merely for demonstrative purposes (focus on the logic and not the code)
2) There are probably better ways to do this. Again, in the absence of other responses, focus on the logic.

Good luck!

1 Like

Re: Page Search by Nobody: 5:43pm On Sep 23, 2012
Yawa, I did think as much that this will need some form of coding language, unfortunately i don't have experience coding 'hard'. But thanks for your input anyway, always appreciated.
Re: Page Search by yawatide(f): 6:26pm On Sep 23, 2012
No worries. Remember, you can still do it manually, though updating will be a pain.

The "easy" part of it is that, as long as you have a letter that has a count greater than 1, and this value never goes below 1, you only have to deal with hardcoding once wink

Again, good luck!

(1) (Reply)

Threat Alert On Antigravityinc.com / Can You Teach Website Designing?: / The Leading Abuja Website, Blog, Online Magazine, Business Directory Etc...

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2021 Oluwaseun Osewa. All rights reserved. See How To Advertise. 32
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.