×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: List of all added hotshots with picture and adress

List of all added hotshots with picture and adress 13 years 3 months ago #11383

  • Jörg Schmidt
  • Jörg Schmidt's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 14
  • Thank you received: 0
Hello, i am new here and i searched this forum but i didn't find a solution for my question. Maybe some here can help me.

I am searching for a solution to show a list of all hotspot-places in an new tab named ›list‹ between ›hotspot‹ and ›add hotspot‹ with thumbnail, name, adress and short deskription. The name of all listed hotshots shoud be a link to the detailpage.

Is this possible?

List of all added hotshots with picture and adress 13 years 3 months ago #11384

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081

List of all added hotshots with picture and adress 13 years 3 months ago #11386

  • Jörg Schmidt
  • Jörg Schmidt's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 14
  • Thank you received: 0
Hello Daniel,

thank you for your fast answer. I found that but it isn't what I mean at all. I want to get a new tab and in this new tab there should be a list of all hotspots with its tumbnail, adress and short description. I this forum i found a way to create an new tab an it works perfectly:
http://compojoom.com/forum/27-hotspots/52-newbie-area/9661-adding-new-tab

But now i want to fill this tab not with static text like in the explanation: In this tab should be list all published hotspots. There must be a way to combinate these two changes but I don't now how. And it will be perfect if not only the names where listed but also the tumbnails, adress and short description.

Maybe you know a way to realize that?

Thanks a lot and greetings,
Jörg

P.S.: Please don't care about the mistakes in the text, my engish isn't that good.

List of all added hotshots with picture and adress 13 years 3 months ago #11389

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Hey Jörg,
To be honest with you - we are planning to introduce this feature in the next release. (man we are planning to introduce so many features!) That is why I don't want to spend several hours explaining how to make this. (it would be much better to spend those hours in coding and finishing the new release earlier :))

Am besten, warte für die nächste Version ;)

List of all added hotshots with picture and adress 13 years 3 months ago #11390

  • Jörg Schmidt
  • Jörg Schmidt's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 14
  • Thank you received: 0
Ok, thanks. I will wait for the new version :-)
Do know when it will be published?

List of all added hotshots with picture and adress 13 years 3 months ago #11391

  • Jörg Schmidt
  • Jörg Schmidt's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 14
  • Thank you received: 0
Hello again Daniel,

after some experiments I found an easy way to create a simple list of all hotspots in a new tab. It based on your explanation for creating a new tab: http://compojoom.com/forum/27-hotspots/52-newbie-area/9661-adding-new-tab#p11098

The only thing I did, was to replace the code in Line 317
echo 'test';
with this code:
$user = "PUT HERE THE USERNAME OF YOUR DATABASE";
$pass = "PUT HERE THE PASSWORD OF YOUR DATABASE";
$dbase = "PUT HERE THE NAME OF YOUR DATABASE";
$db = mysql_connect($host, $user, $pass) or die ("connection error");
      mysql_select_db($dbase, $db) or die ("no connection to the database");
$select = "select * from jos_hotspots_marker";
$result = mysql_query($select,$db);
if($result){
 echo "<table>";
 while($row = mysql_fetch_array($result)){
   echo "<tr><td rowspan=\"4\"><img src=\"http://YOUR.DOMAIN.COM/media/com_hotspots/images/thumbs/".$row['picture_thumb']."\" /></td><td><a href=\"http://YOUR.DOMAIN.COM/index.php?option=com_hotspots&view=hotspot&id=".$row['id']."\"><strong>".$row['name']."</strong></a></td></tr>";
   echo "<tr><td>".$row['street']."</td></tr>";
   echo "<tr><td>".$row['plz']." ".$row['town']."</td></tr>";
   echo "<tr><td>".$row['description_small']."</td></tr>";
 }
 echo "</table>";
}

You just have to replace the BIG LETTERS with your data and it creates a simple list with tumbnail, name with link, adress and short description in a new tab. One problem I have is, that special letters (like ä,ö,ü,ß) don't showed correctly. Maybe you know why? Another: If someone kicks on one of links in the list there is no link one the page of the hotspot to get back to list and not to the map.

Maybe someone here can use it or can make some suggestions to make this little part of code better...

Here is a link to the page where I tested it:
http://leertest.klapperfeld.de/index.php?option=com_hotspots&view=all&Itemid=54
(plaese ignore the design, it is only for testing)

List of all added hotshots with picture and adress 13 years 3 months ago #11392

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Interesting, you made it that far, without any php knowledge.
Check the database and make sure that the collation of all hotspots table is set to utf8_general_ci and the the collation of the fields inside is also set to utf8_general_ci.
also you can change this code:
$user = "PUT HERE THE USERNAME OF YOUR DATABASE";
 
$pass = "PUT HERE THE PASSWORD OF YOUR DATABASE";
 
$dbase = "PUT HERE THE NAME OF YOUR DATABASE";
 
$db = mysql_connect($host, $user, $pass) or die ("connection error");
 
      mysql_select_db($dbase, $db) or die ("no connection to the database");
 
$select = "select * from jos_hotspots_marker";
 
$result = mysql_query($select,$db);
 
if($result){
 
 echo "<table>";
 
 while($row = mysql_fetch_array($result)){
 
   echo "<tr><td rowspan=\"4\"><img src=\"http://YOUR.DOMAIN.COM/media/com_hotspots/images/thumbs/".$row['picture_thumb']."\" /></td><td><a href=\"http://YOUR.DOMAIN.COM/index.php?option=com_hotspots&view=hotspot&id=".$row['id']."\"><strong>".$row['name']."</strong></a></td></tr>";
 
   echo "<tr><td>".$row['street']."</td></tr>";
 
   echo "<tr><td>".$row['plz']." ".$row['town']."</td></tr>";
 
   echo "<tr><td>".$row['description_small']."</td></tr>";
 
 }
 
 echo "</table>";
 
}
 

with this one:
$db = JFactory::getDBO();
 
$select = "select * from jos_hotspots_marker";
 
$result = $db->setQuery($select);
$rows = $db->loadAssocList();
 
 echo "<table>";
 
 foreach($rows as $key => $row){
 
   echo "<tr><td rowspan=\"4\"><img src=\"http://YOUR.DOMAIN.COM/media/com_hotspots/images/thumbs/".$row['picture_thumb']."\" /></td><td><a href=\"http://YOUR.DOMAIN.COM/index.php?option=com_hotspots&view=hotspot&id=".$row['id']."\"><strong>".$row['name']."</strong></a></td></tr>";
 
   echo "<tr><td>".$row['street']."</td></tr>";
 
   echo "<tr><td>".$row['plz']." ".$row['town']."</td></tr>";
 
   echo "<tr><td>".$row['description_small']."</td></tr>";
 
 }
 
 echo "</table>";
 
}
 

List of all added hotshots with picture and adress 13 years 3 months ago #11394

  • Jörg Schmidt
  • Jörg Schmidt's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 14
  • Thank you received: 0
Hallo daniel, thank you for your changes and infos. Now it works with special characters. In your code was just one little mistake. There was one »}« to much at the end. And I did one other change in the code: I added
extract($_SERVER); 
$PFAD = "http://$SERVER_NAME"; 
at the beginning and replaced YOUR.DOMAIN.COM against
".$PFAD."
so it can be used without any changes on each domain.
Here again the complete code:
extract($_SERVER); 
$PFAD = "http://$SERVER_NAME"; 
$db = JFactory::getDBO();
$select = "select * from jos_hotspots_marker";
$db = JFactory::getDBO();
$select = "select * from jos_hotspots_marker";
$result = $db->setQuery($select);
$rows = $db->loadAssocList();
 echo "<table>";
 foreach($rows as $key => $row){
   echo "<tr><td rowspan=\"4\"><img src=\"".$PFAD."/media/com_hotspots/images/thumbs/".$row['picture_thumb']."\" /></td><td><a href=\"".$PFAD."/index.php?option=com_hotspots&view=hotspot&id=".$row['id']."\"><strong>".$row['name']."</strong></a></td></tr>";
   echo "<tr><td>".$row['street']."</td></tr>";
   echo "<tr><td>".$row['plz']." ".$row['town']."</td></tr>";
   echo "<tr><td>".$row['description_small']."</td></tr>";
 }
 echo "</table>";

List of all added hotshots with picture and adress 13 years 3 months ago #11396

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
I think it would be better if you use the joomla funciton for urls JRoute::_();
$PFAD."/index.php?option=com_hotspots&view=hotspot&id=".$row['id']
to
JRoute::_("/index.php?option=com_hotspots&view=hotspot&id=".$row['id'])

and this
<img src=\"".$PFAD."/media/com_hotspots/images/thumbs/".$row['picture_thumb']."\" />
to
<img src=\"".JURI::root()."/media/com_hotspots/images/thumbs/".$row['picture_thumb']."\" />

Also in the template there is no need to escape the characters \"

List of all added hotshots with picture and adress 13 years 3 months ago #11402

  • Jörg Schmidt
  • Jörg Schmidt's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 14
  • Thank you received: 0
I have changed it and i added a query to check if their is an image or not. So there wront be an img-tag if their is no image and so ie or safari don't shows an error-image:
$db = JFactory::getDBO();
$select = "select * from jos_hotspots_marker";
$db = JFactory::getDBO();
$select = "select * from jos_hotspots_marker";
$result = $db->setQuery($select);
$rows = $db->loadAssocList();
 echo "<table>";
 foreach($rows as $key => $row){
if (!empty($row['picture_thumb'])) echo "<tr><td rowspan=\"4\"><img src=\"".JURI::root()."/media/com_hotspots/images/thumbs/".$row['picture_thumb']."\" /></td><td><a href=\"".JURI::root()."/index.php?option=com_hotspots&view=hotspot&id=".$row['id']."\"><strong>".$row['name']."</strong></a></td></tr>";
    else echo "<tr><td rowspan=\"4\">&nbsp;</td><td><a href=\"".JURI::root()."/index.php?option=com_hotspots&view=hotspot&id=".$row['id']."\"><strong>".$row['name']."</strong></a></td></tr>"; 
   echo "<tr><td>".$row['street']."</td></tr>";
   echo "<tr><td>".$row['plz']." ".$row['town']."</td></tr>";
   echo "<tr><td>".$row['description_small']."&nbsp;</td></tr>";
 }
 echo "</table>";
  • Page:
  • 1
Time to create page: 0.149 seconds