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
Template logic was working, now isnt.
-
- Rank: Expert
- Registered: Dec 31, 1969
- Last visit: Oct 21, 2009
- Posts: 1437
LOL, duh. Woops, thanks. Got any ideas about what i need to do to have more control over the category placement? -
- Rank: Team Member
- Registered: Mar 18, 2002
- Last visit: Oct 21, 2009
- Posts: 6606
-
- Rank: Expert
- Registered: Dec 31, 1969
- Last visit: Oct 21, 2009
- Posts: 1437
Not exactly sure if this is what your looking for.
Code
/**
* Get categories
*
* This user api function builds a list of the available categories.
*
* @param void
* @return array This is an array of the available
* categories.
*/
function pxPDFManager_userapi_getcategories($args) {
// Create a container array for the categories.
$categories = 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, 'pxPDFManager::', '::', ACCESS_READ)) {
return $link_listing;
}
// Check to see if we should see the private or public
// categories.
if (! isset($args['private'])) {
$args['private'] = 0;
}
// Get datbase setup - note that both pnDBGetConn() and pnDBGetTables()
// return arrays but we handle them differently. For pnDBGetConn() we
// currently just want the first item, which is the official database
// handle. For pnDBGetTables() we want to keep the entire tables array
// together for easy reference later on.
$dbconn =& pnDBGetConn(true);
$pntables =& pnDBGetTables();
// It's good practice to name the table and column definitions you are
// getting - $table and $column don't cut it in more complex modules
$pdf_categories_table = $pntables['pdf_categories'];
$pdf_categories_column = &$pntables['pdf_categories_column'];
// Build the sql query to select a list of the categories.
$categories_sql = "
SELECT $pdf_categories_column[category_id],
$pdf_categories_column[category_name]
FROM $pdf_categories_table
WHERE $pdf_categories_column[private] = '". $args['private'] ."';
";
// Execute the categories query and return the result set.
$result =& $dbconn->Execute($categories_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', __ERROR_PXPDFMANAGER_GETCATEGORIESFAILED);
return false;
}
// Loop through the result set.
for (; !$result->EOF; $result->MoveNext()) {
// For each "node" in the result set list the
// category_id and category_name fields.
list($category_id, $category_name) = $result->fields;
// Add this category to the categories container.
$categories[] = array('category_id' => $category_id,
'category_name' => $category_name);
}
// Close the result set.
$result->Close();
// Return the categories array.
return $categories;
} -
- Rank: Team Member
- Registered: Mar 18, 2002
- Last visit: Oct 21, 2009
- Posts: 6606
Just an array dump would have been ok.... So the earlier template logic will give the ability to display certain things depending on the category name. What exactly is the problem and what are you trying to achieve?
-Mark
--
Visit My homepage and Zikula themes. -
- Rank: Expert
- Registered: Dec 31, 1969
- Last visit: Oct 21, 2009
- Posts: 1437
The problem that i have left to fix is better control of placement of the categories. It originally was setup to do a loop (foreach) that would make a new column for each category. Well, now I have more categories that before and would like to organize it differently. So now i want categories 1,2, and 3 in row 1 and 4,5 and 6 in row 2. Plus cat 7 in row 3. I think i might almost have it, but i think im having more of a formatting problem at the moment. -
- Rank: Expert
- Registered: Dec 31, 1969
- Last visit: Oct 21, 2009
- Posts: 1437
-
- Rank: Team Member
- Registered: Mar 18, 2002
- Last visit: Oct 21, 2009
- Posts: 6606
You can access array items directly via e.g. etc.
However maybe you don't need something like this but can use HTML to your advantage. Look at the way the admin panel is implemented in .760. We use a fixed width div (the fixed width is dynamically calculated).
-Mark
--
Visit My homepage and Zikula themes. -
- Rank: Expert
- Registered: Dec 31, 1969
- Last visit: Oct 21, 2009
- Posts: 1437
True, but maybe i want cat 6, then cat 8. Being able to format the data any way i want is definately a plus. -
- Rank: Expert
- Registered: Dec 31, 1969
- Last visit: Oct 21, 2009
- Posts: 1437
Im trying something like this right now for testing. But without this:
Code
<!--[foreach from=$link_listing item=links]-->
it wont load the categories. When i do use it so that it loads them, the formatting is messed up. There must be a way to give the data to the below categories without doing a loop. Sry, my programming logic is shot.
Code
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3"><h2 style="text-align: left;">New Recommendations:</h2></td>
</tr>
<tr>
<td valign="top"> <!--[if $links.category_name == "Feed Needs"]-->
<table width="100%" align="center">
<tr>
<td align="left" valign="top">
<h1 style="text-align: left;"><!--[$links.category_name]--></h1>
<ul class="ul-reports">
<!--[foreach name=linkloop from=$links item=link]-->
<!--[if $link != $links.category_name]-->
<!--[if $smarty.foreach.linkloop.iteration == "1"]-->
<li class="li-latest"><span style="display:block;">UPDATE:</span></li>
<!--[elseif $smarty.foreach.linkloop.iteration == "2"]-->
<li class="li-recent"><span style="display:block;">Recent Updates</span></li>
<!--[/if]-->
<li class="li-content">
<a href="<!--[pnmodurl modname="pxPDFManager" type="user" func="downloadpdf" pdf_id="`$link.link_id`"]-->" target="_blank"><!--[$link.link_name]--></a>
</li>
<!--[/if]-->
<!--[/foreach]-->
</ul>
</td>
</tr>
</table>
<!--[/if]--></td>
<td valign="top"><!--[if $links.category_name == "Grain"]-->
<table width="100%" align="center">
<tr>
<td align="left" valign="top">
<h1 style="text-align: left;"><!--[$links.category_name]--></h1>
<ul class="ul-reports">
<!--[foreach name=linkloop from=$links item=link]-->
<!--[if $link != $links.category_name]-->
<!--[if $smarty.foreach.linkloop.iteration == "1"]-->
<li class="li-latest"><span style="display:block;">UPDATE:</span></li>
<!--[elseif $smarty.foreach.linkloop.iteration == "2"]-->
<li class="li-recent"><span style="display:block;">Recent Updates</span></li>
<!--[/if]-->
<li class="li-content">
<a href="<!--[pnmodurl modname="pxPDFManager" type="user" func="downloadpdf" pdf_id="`$link.link_id`"]-->" target="_blank"><!--[$link.link_name]--></a>
</li>
<!--[/if]-->
<!--[/foreach]-->
</ul>
</td>
</tr>
</table>
<!--[/if]--></td>
<td valign="top"><!--[if $links.category_name == "Livestock"]-->
<table width="100%" align="center">
<tr>
<td align="left" valign="top">
<h1 style="text-align: left;"><!--[$links.category_name]--></h1>
<ul class="ul-reports">
<!--[foreach name=linkloop from=$links item=link]-->
<!--[if $link != $links.category_name]-->
<!--[if $smarty.foreach.linkloop.iteration == "1"]-->
<li class="li-latest"><span style="display:block;">UPDATE:</span></li>
<!--[elseif $smarty.foreach.linkloop.iteration == "2"]-->
<li class="li-recent"><span style="display:block;">Recent Updates</span></li>
<!--[/if]-->
<li class="li-content">
<a href="<!--[pnmodurl modname="pxPDFManager" type="user" func="downloadpdf" pdf_id="`$link.link_id`"]-->" target="_blank"><!--[$link.link_name]--></a>
</li>
<!--[/if]-->
<!--[/foreach]-->
</ul>
</td>
</tr>
</table>
<!--[/if]--></td>
</tr>
<tr>
<td colspan="3"><h2 style="text-align: left;">Current Postions:</h2></td>
</tr>
<tr>
<td valign="top"> <!--[if $links.category_name == "Livestock"]-->
<table width="100%" align="center">
<tr>
<td align="left" valign="top">
<h1 style="text-align: left;"><!--[$links.category_name]--></h1>
<ul class="ul-reports">
<!--[foreach name=linkloop from=$links item=link]-->
<!--[if $link != $links.category_name]-->
<!--[if $smarty.foreach.linkloop.iteration == "1"]-->
<li class="li-latest"><span style="display:block;">UPDATE:</span></li>
<!--[elseif $smarty.foreach.linkloop.iteration == "2"]-->
<li class="li-recent"><span style="display:block;">Recent Updates</span></li>
<!--[/if]-->
<li class="li-content">
<a href="<!--[pnmodurl modname="pxPDFManager" type="user" func="downloadpdf" pdf_id="`$link.link_id`"]-->" target="_blank"><!--[$link.link_name]--></a>
</li>
<!--[/if]-->
<!--[/foreach]-->
</ul>
</td>
</tr>
</table>
<!--[/if]--></td>
<td valign="top"><!--[if $links.category_name == "Grain"]-->
<table width="100%" align="center">
<tr>
<td align="left" valign="top">
<h1 style="text-align: left;"><!--[$links.category_name]--></h1>
<ul class="ul-reports">
<!--[foreach name=linkloop from=$links item=link]-->
<!--[if $link != $links.category_name]-->
<!--[if $smarty.foreach.linkloop.iteration == "1"]-->
<li class="li-latest"><span style="display:block;">UPDATE:</span></li>
<!--[elseif $smarty.foreach.linkloop.iteration == "2"]-->
<li class="li-recent"><span style="display:block;">Recent Updates</span></li>
<!--[/if]-->
<li class="li-content">
<a href="<!--[pnmodurl modname="pxPDFManager" type="user" func="downloadpdf" pdf_id="`$link.link_id`"]-->" target="_blank"><!--[$link.link_name]--></a>
</li>
<!--[/if]-->
<!--[/foreach]-->
</ul>
</td>
</tr>
</table>
<!--[/if]--></td>
<td valign="top"><!--[if $links.category_name == "Feed Needs"]-->
<table width="100%" align="center">
<tr>
<td align="left" valign="top">
<h1 style="text-align: left;"><!--[$links.category_name]--></h1>
<ul class="ul-reports">
<!--[foreach name=linkloop from=$links item=link]-->
<!--[if $link != $links.category_name]-->
<!--[if $smarty.foreach.linkloop.iteration == "1"]-->
<li class="li-latest"><span style="display:block;">UPDATE:</span></li>
<!--[elseif $smarty.foreach.linkloop.iteration == "2"]-->
<li class="li-recent"><span style="display:block;">Recent Updates</span></li>
<!--[/if]-->
<li class="li-content">
<a href="<!--[pnmodurl modname="pxPDFManager" type="user" func="downloadpdf" pdf_id="`$link.link_id`"]-->" target="_blank"><!--[$link.link_name]--></a>
</li>
<!--[/if]-->
<!--[/foreach]-->
</ul>
</td>
</tr>
</table>
<!--[/if]--></td>
</tr>
<tr>
<td colspan="3"><h2 style="text-align: left;">Track Record:</h2></td>
</tr>
<tr>
<td valign="top"> <!--[if $links.category_name == "Track Record"]-->
<table width="100%" align="center">
<tr>
<td align="left" valign="top">
<h1 style="text-align: left;"><!--[$links.category_name]--></h1>
<ul class="ul-reports">
<!--[foreach name=linkloop from=$links item=link]-->
<!--[if $link != $links.category_name]-->
<!--[if $smarty.foreach.linkloop.iteration == "1"]-->
<li class="li-latest"><span style="display:block;">UPDATE:</span></li>
<!--[elseif $smarty.foreach.linkloop.iteration == "2"]-->
<li class="li-recent"><span style="display:block;">Recent Updates</span></li>
<!--[/if]-->
<li class="li-content">
<a href="<!--[pnmodurl modname="pxPDFManager" type="user" func="downloadpdf" pdf_id="`$link.link_id`"]-->" target="_blank"><!--[$link.link_name]--></a>
</li>
<!--[/if]-->
<!--[/foreach]-->
</ul>
</td>
</tr>
</table>
<!--[/if]--></td>
<td valign="top"><!--[if $links.category_name == "Blank"]-->
<table width="100%" align="center">
<tr>
<td align="left" valign="top">
<h1 style="text-align: left;"><!--[$links.category_name]--></h1>
<ul class="ul-reports">
<!--[foreach name=linkloop from=$links item=link]-->
<!--[if $link != $links.category_name]-->
<!--[if $smarty.foreach.linkloop.iteration == "1"]-->
<li class="li-latest"><span style="display:block;">UPDATE:</span></li>
<!--[elseif $smarty.foreach.linkloop.iteration == "2"]-->
<li class="li-recent"><span style="display:block;">Recent Updates</span></li>
<!--[/if]-->
<li class="li-content">
<a href="<!--[pnmodurl modname="pxPDFManager" type="user" func="downloadpdf" pdf_id="`$link.link_id`"]-->" target="_blank"><!--[$link.link_name]--></a>
</li>
<!--[/if]-->
<!--[/foreach]-->
</ul>
</td>
</tr>
</table>
<!--[else]--><!--HIDEME--><!--[/if]--></td>
<td valign="top"><!--[if $links.category_name == "Blank"]-->
<table width="100%" align="center">
<tr>
<td align="left" valign="top">
<h1 style="text-align: left;"><!--[$links.category_name]--></h1>
<ul class="ul-reports">
<!--[foreach name=linkloop from=$links item=link]-->
<!--[if $link != $links.category_name]-->
<!--[if $smarty.foreach.linkloop.iteration == "1"]-->
<li class="li-latest"><span style="display:block;">UPDATE:</span></li>
<!--[elseif $smarty.foreach.linkloop.iteration == "2"]-->
<li class="li-recent"><span style="display:block;">Recent Updates</span></li>
<!--[/if]-->
<li class="li-content">
<a href="<!--[pnmodurl modname="pxPDFManager" type="user" func="downloadpdf" pdf_id="`$link.link_id`"]-->" target="_blank"><!--[$link.link_name]--></a>
</li>
<!--[/if]-->
<!--[/foreach]-->
</ul>
</td>
</tr>
</table>
<!--[else]--><!--HIDEME--><!--[/if]--></td>
</tr>
</table> -
- Rank: Team Member
- Registered: Mar 18, 2002
- Last visit: Oct 21, 2009
- Posts: 6606
'Messed up' isn't a very useful.... Try validating the HTML - maybe this is the problem. Then try to narrow the template down to just the basic components and build it back up again until you isolate the problem. This isn't one that can be easily solved in a forum post.....
-Mark
--
Visit My homepage and Zikula themes. -
- Rank: Expert
- Registered: Dec 31, 1969
- Last visit: Oct 21, 2009
- Posts: 1437
I understand. It actually validates fine though. Just creates extra columns for some reason. So is there not a way for the categories to get their data without a loop? -
- Rank: Expert
- Registered: Dec 31, 1969
- Last visit: Oct 21, 2009
- Posts: 1437
- Moderated by:
- Support
