The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Wed Jul 25, 2007 5:00 am 
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Sat Sep 16, 2006 8:50 pm
Posts: 271
Location: San Antonio, Texas
i am trying to create a menu system for a dot mobi site and need to use accesskeys

I have got my results back fine and now i am trying to format them to display properly - i did have them working as i wanted at one point and then *ahem* over wrote the code and had to start all over again.....

this is where i am now and i have come to a brick wall... this is how i want my results to look...

[1] Home
[2] About Us
etc
etc

Each item title being a link - I need the [1] and [2] [etc] to increment per row result and will also need the same number to be inserted into the link as an accesskey="x"

Hope that makes sense....

The code i been have working on without the incremented numbers looks like this...

Code:
function getMobimenus() {
  global $database;
        $sql = 'SELECT * FROM jos_menu WHERE menutype = \'mobimenu\' AND published = 1 ORDER BY ordering ASC';
        $database->setQuery( $sql );
        $rows = $database->loadObjectList();
        foreach ( $rows as $row )     
  echo "[**** need incremented number here****] <a href=\"$row->link\" accesskey=\"**** need incremented number here****\">$row->name</a><br/>\n"; 
  }
getMobimenus();


I found the looping example on w3schools website but couldnt figure out how to get the following code to work with the above...

Code:
$i=1;
while($i<=5)
  {
  echo "[" . $i . "]";
  $i++;
  }


perhaps im missing something blindingly obvious but any input would be greatly appreciated

also i found a similar example on another site

Code:
$result = mysql_query($sql);
$thenumber = 1;
while ($row = mysql_fetch_array ($result)) {
    echo $thenumber . ' - ' . $row['name'];
     $thenumber++;
}


but i think the mysql functions arent responding when i run it joomla...


Last edited by sa247 on Wed Jul 25, 2007 5:05 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Wed Jul 25, 2007 8:38 am 
User avatar
Joomla! Guru
Joomla! Guru
Offline

Joined: Wed Jul 04, 2007 4:54 am
Posts: 924
Location: Kuala Lumpur, Malaysia
sent you a pm as i think this is a bit too heavy for a general discussion. but if others think otherwise i'd gladly post here.

_________________
http://www.joomlah.net [] http://www.joomlah.org


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 



Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group