From a complete list how to show index wise A,B,C,D,....
I have a complete list of a topics.
I have to create a Index for A B C D E ...
On Clicking those buttons without navigating to another page it shows only topics wich starts from that letter...
How to code it in php???
kirtan_thakkar
Junior Poster in Training
79 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
suppose your page is post.php
So for A button link should be http://doimain.com/post.php?start=a
So your query will be dynamic like below:
<?php
if(isset($_GET['start']))
{
$sql ="select * from table name WHERE name LIKE '".$_GET['start']."%'";
}
else
{
$sql="select * from table";
}
?>
Hope this helps
Avinash
Thanks for the post but i am not using mysql...
Is there any other way to do this..
kirtan_thakkar
Junior Poster in Training
79 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
So what are you using for your backend???
I have created text files and using php to open it and show that text into webpage.
There are categories for the topics so I have to create it on the index page..
kirtan_thakkar
Junior Poster in Training
79 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
Hi,
Do you have naming conventions for this text files?
Regards,
Al
naming conventions?? What's that??
kirtan_thakkar
Junior Poster in Training
79 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
You can have a CSS (style) based system if you're not using a backend (files/DB) of any type. This means that you use php to set a classname on a div. This method isn't advised though because all your data is loaded into the page, but only a particular section (say div B) is visible to the user.
If you don't want to use a DB - an include file system would be your best bet, linked with a querystring ($_GET).
diafol
Rhod Gilbert Fan (ardav)
7,800 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
You can have a CSS (style) based system if you're not using a backend (files/DB) of any type. This means that you use php to set a classname on a div. This method isn't advised though because all your data is loaded into the page, but only a particular section (say div B) is visible to the user.
If you don't want to use a DB - an include file system would be your best bet, linked with a querystring ($_GET).
I am trying to say tha As if I have list of Countrys As like this:
australia
canada
europe
japan
usa
france
germany
italy
spain
asia
china
mexico
oceania
africa
netherlands
india
switzerland
sweden
singapore
ireland
brazil
england
invisible
austria
parties
belgium
thailand
norway
malaysia
finland
denmark
birthdays
uk
taiwan
college
russia
portugal
And on the page I will put A B C D ..
on clicking on A script should have to show the names which are starting from A...
And also With Hyperlink on it..
kirtan_thakkar
Junior Poster in Training
79 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
Hi,
This should get you started.
<?php
if ($handle = opendir('joomla')) {
while (false !== ($file = readdir($handle))) {
if(substr($file,0,1) == "c")
echo $file."\n";
}
closedir($handle);
}
?>
Regards,
Al
Oh thanks I have understood...
Thank you so much buddy..
kirtan_thakkar
Junior Poster in Training
79 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
hey..
Is there any way to put a hyperlink on that list like..
After clicking on "A" I got Australia and Austria. Is there any way to put a link on Australia and Austria..
If I have created folders like these..
country > Australia, Austria
And in each folder I have index.php file.
So can I put a link like it
That $file is the directory which he has fond on the country directory..
kirtan_thakkar
Junior Poster in Training
79 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
Yes,
echo "<a href='mysite.com/country/".$file."'>".$file."</a>\n";
Thanks........................
kirtan_thakkar
Junior Poster in Training
79 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
Every one of you are bonkers. I didn't follow a single lime of the last couple of threads. But there again, I'm exceedingly ....
diafol
Rhod Gilbert Fan (ardav)
7,800 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
Every one of you are bonkers. I didn't follow a single lime of the last couple of threads. But there again, I'm exceedingly ....
What was that???
kirtan_thakkar
Junior Poster in Training
79 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0