Watch
GitHub Core
Show your support for Zikula! Sign up at Github account and watch the Core project!
GitHub Modules
- mesteele101 responded to »ERR (3): E_USER_ERROR: Smarty error: [in pagesvar:pagesitem2en line XXX]…« 07:01 AM
- mazdev responded to »Pages 2.5.0 and updating - Page not found« 06:41 AM
- ehdwma created topic »Hide "Register new account" and change template to 3 col« 06:27 AM
- mesteele101 responded to »Zikula 1.3.3 - Selecting a category in Pages not working« 01:29 AM
- mdee created topic »How to implement returnpage ?« 01:00 AM
- nestormateo responded to »Fillters in Clip« 24. May
- damon responded to »Can the Updated Version Check be Turned Off (Z 1.3)« 24. May
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
Page alphabetically?
-
**unknown user**
- Rank: Softmore
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 379
I have a lot of lists, and they're sorted alphabetically, but currently they're separated into lists of 10, and it's hard to figure out where the letter you're looking for is. What I'd like to do is maybe put an alphabet on top so they can click on a letter and have it bring up a page with the first entry being the first starting with that letter. Is there a way to do this without complicated programming hoop-jumping? :) -
**unknown user**
- Rank: Softmore
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 413
Hey jedi have you taken a look at the pnEmployee module ( and advanced contacts module ) it has a function like that though it uses the old pnHTML methods rather than pnrender it might be able to give you an idea since you are better at reading and understanding the code than the likes of myself.
-SUNADMN -
**unknown user**
- Rank: Softmore
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 413
Nevermind I found it again go here:
http://www.smiatek.com/modules.php?op=modload&name=Downloads&file=index&req=viewsdownload&sid=3 -
- Rank: Team Member
- Registered: Mar 18, 2002
- Last visit: Oct 21, 2009
- Posts: 6606
For pnRender there's a companion to the pager plugin called pagerabc that can create an alphabetic filter. For an example see the members list module on my site (now running .760RC1).
-Mark
--
Visit My homepage and Zikula themes. -
**unknown user**
- Rank: Softmore
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 379
After quite a lot of poking, I think I have this solved.
I had to pass a new variable, which is the first letter of the page I want to look at. So I picked $startlet. I then re-did my SQL so that it returned only things LIKE $startlet%, then just did Execute, rather than SelectLimit for the query. Worked a treat. :)
Here's my code, if you're interested.
API
Code
function projects_userapi_getall_projects($args)
{
// Get arguments from argument array
extract($args);
// Optional arguments.
if (!isset($startlet)) {
$startlet= 'A';
}
$items = array();
// Security check - important to do this as early on as possible to
// avoid potential security holes or just too much wasted processing
if (!pnSecAuthAction(0, 'projects::', '::', ACCESS_OVERVIEW)) {
return $items;
}
// Get datbase setup
$dbconn =& pnDBGetConn(true);
$pntable =& pnDBGetTables();
$projecttable = $pntable['project_projects'];
$projectcolumn = &$pntable['project_projects_column'];
// Get items
$sql = "SELECT $projectcolumn[projid],
$projectcolumn[givennum],
$projectcolumn[title],
$projectcolumn[summary],
$projectcolumn[budget],
$projectcolumn[length],
$projectcolumn[status],
$projectcolumn[startdate],
$projectcolumn[enddate],
$projectcolumn[updated]
FROM $projecttable
WHERE $projectcolumn[title] LIKE '".$startlet."%'
ORDER BY $projectcolumn[title]";
$result = $dbconn->Execute($sql);
// Check for an error with the database code, and if so set an appropriate
// error message and return
if ($dbconn->ErrorNo() != 0) {
pnSessionSetVar('errormsg', _GETFAILED);
return false;
}
// Put items into result array. Note that each item is checked
// individually to ensure that the user is allowed access to it before it
// is added to the results array
for (; !$result->EOF; $result->MoveNext()) {
list($projid, $givennum, $title, $summary, $budget, $length, $status, $startdate, $enddate, $updated) = $result->fields;
if (pnSecAuthAction(0, 'projects::', "$title::$projid", ACCESS_OVERVIEW)) {
$items[] = array('projid' => $projid,
'givennum' => $givennum,
'title' => $title,
'summary' => $summary,
'budget' => $budget,
'length' => $length,
'status' => $status,
'startdate' => $startdate,
'enddate' => $enddate,
'updated' => $updated);
}
}
// All successful database queries produce a result set, and that result
// set should be closed when it has been finished with
$result->Close();
// Return the items
return $items;
}
Relevant pnuser code:
Code
function projects_user_view_projects($args)
{
// Security check
if (!pnSecAuthAction(0, 'projects::', '::', ACCESS_OVERVIEW)) {
return pnVarPrepHTMLDisplay(_MODULENOAUTH);
}
// Get parameters from whatever input we need.
$startlet = pnVarCleanFromInput('startlet');
if (!isset($startlet)) {
$startlet = 'A';
}
// Load API.
if (!pnModAPILoad('projects', 'user')) {
return pnVarPrepHTMLDisplay(_LOADFAILED);
}
// The API function is called.
$items = pnModAPIFunc('projects',
'user',
'getall_projects',
array('startlet' => $startlet));
...
$pnRender->assign('items', $projectitems);
// assign the values for the smarty plugin to produce a pager in case of there
// being many items to display.
$pnRender->assign('pagerabc', array('numitems' => pnModAPIFunc('projects',
'user',
'countitems_projects'),
'itemsperpage' => $itemsperpage));
// Let any hooks know that we are displaying the overview.
$pnRender->assign('hooks' ,pnModCallHooks('category',
'display',
$startlet,
pnModURL('projects',
'user',
'view_projects',
array('startlet' => $startlet))));
}
htm template code:
Code
<!--[pagerabc show="page"
posvar="module=Projects&type=admin&func=view_projects&startlet"
separator=" - "
names="A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z"]--> -
- Rank: Expert
- Registered: Dec 02, 2002
- Last visit: Apr 30, 2010
- Posts: 1474
markwest
For pnRender there's a companion to the pager plugin called pagerabc that can create an alphabetic filter. For an example see the members list module on my site (now running .760RC1).
-Mark
\i see you have a new theme installed - quite nice. I also notice that your memberslist URL comes up like this:
http://www.markwest.me.uk/index.php?&module=Members_List&func=main&letter=H
just curious, whats with the ampersand straight after the question mark? is this something for mod rewrite shorturl stuff?
--
-Lobos
Professional PHP Framework Services: Concept, Development and Deployment -
- Rank: Team Member
- Registered: Mar 18, 2002
- Last visit: Oct 21, 2009
- Posts: 6606
Lobos,
Thanks for comments on the theme - Not mine however.... It's a port of a drupal port of a wordpress template (see the link at the bottom). Still I think it looks really nice and clean - it also gives me the oppurtunity to show a few of the simpler things you can do with .760 and the starting of full templating of modules.
The extra ampersand is a 'feature' of the alpha pager that i've yet to fix properly. In the template you tell the plugin what variables to pass back on. So in this case the vars module, type & func get added in addition to the letter in the pager urls. The plugin doesn't quite spot which one is the first var hence the extra ampersand.
-Mark
--
Visit My homepage and Zikula themes. -
- Rank: Expert
- Registered: Dec 02, 2002
- Last visit: Apr 30, 2010
- Posts: 1474
markwest
Lobos,
The extra ampersand is a 'feature' of the alpha pager that i've yet to fix properly. In the template you tell the plugin what variables to pass back on. So in this case the vars module, type & func get added in addition to the letter in the pager urls. The plugin doesn't quite spot which one is the first var hence the extra ampersand.
Ah I thought this may have been the case, it´s a loop thing, correct? It is at times vexing when you have things that come up like this - every thing is identical but the first variable / item / thing - infact they should have just made these urls without the ? and just started with plain ole & (i guess they need to know when the URL stops though...).
--
-Lobos
Professional PHP Framework Services: Concept, Development and Deployment -
- Rank: Team Member
- Registered: Mar 18, 2002
- Last visit: Oct 21, 2009
- Posts: 6606
I've fixed this little bug in cvs. The urls still work so it's not really major problem. However grab a an updated version of the plugin from cvs to fix the problem.
-Mark
--
Visit My homepage and Zikula themes. -
- Rank: Registered User
- Registered: Jul 29, 2008
- Last visit: Oct 21, 2009
- Posts: 5
Hi there...I've been trying to figure out how to do an alphabetical pager. I'm working on translating a language, and I have a list of translated words that I'd like to be able to sort alphabetically...I noticed that the "Modules" module has an alphabetical pager...I was wondering if i could scoop the pager code from there and tweak it to work on the list.
Some background...I'm running the most recent release of Zikula, and my language list is incorporated into a module called EckDec that I developed by tweaking the example module
Any feedback is welcome!!!
P.S. in case you wanted to take a look... here is the URL to my test site
http://bennukhepera.…type=user&func=view
edited by: BennuKhepera, Sep 09, 2008 - 09:45 PM
- Moderated by:
- Support
Users on-line
- 0 users
This list is based on users active over the last 60 minutes.
