我在自定义Joomla组件上设置了分页。为了避免页面冗长的解释,我们正在做一些错综复杂的iframe嵌入和前向掩盖。这是组件前端的分页。Joomla分页URL不包含view = viewname
在我的iframe中,我有一个小狗列表(来自自定义组件)。它是分页的。为了使幼犬在iframe中正确显示它有网址:
但是当我真正点击分页链接,第2页上则丢弃该视图=微型导致的问题。我怎样才能调整这个,使它不会下降view = microsite?
这个分页的代码是长,模型,视图和view.html.php之间,似乎很难让我发布所有相关的代码。这里有一些虽然我一直在寻找。
任何想法或提示何处/如何做到这一点?
感谢 扎克
// Get the pagination request variables
$limit = $app->input->get('limit', $params->get('display_num', 20), 'uint');
$limitstart = $app->input->get('limitstart', 0, 'uint');
$this->setState('puppies.limit', $limit);
$this->setState('puppies.limitstart', $limitstart);
// Load the parameters.
$this->setState('params', $params);
}
/** Method to get a store id based on the model configuration state. **/
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':' . $this->getState('puppies.breed_alias');
$id .= ':' . $this->getState('puppies.limit');
$id .= ':' . $this->getState('puppies.limitstart');
$id .= ':' . serialize($this->getState('puppies.filter'));
$id .= ':' . $this->getState('puppies.featured');
return parent::getStoreId($id);
}
/** Method to get a JPagination object for the data set. **/
public function getPagination()
{
// Create the pagination object.
$limit = (int) $this->getState('puppies.limit');
$page = new JPagination($this->getTotal(), $this->getStart(), $limit);
return $page;
}
/** Method to get the total number of items for the data set. **/
public function getTotal()
{
return $this->items_total;
}
/** Method to get the starting number of items for the data set. **/
public function getStart()
{
$start = $this->getState('puppies.limitstart');
$limit = $this->getState('puppies.limit');
$total = $this->getTotal();
if ($start > $total - $limit)
{
$start = max(0, (int) (ceil($total/$limit) - 1) * $limit);
}
return $start;
}
同样,这里的代码的一部分,但我不知道该怎么开始张贴了一个答案,所以请我将张贴任何代码,但是点我在正确的方向, 谢谢。
我想我可能错过了一个文件,当创建这个新的视图,但看着其他的我可以告诉这肯定会解决我的问题..一旦我设置该视图的管理表单。 – 2013-03-04 00:41:36
应该在管理员目录下还是在组件目录下? – 2013-03-04 00:44:27
很高兴知道!不确定这是否会对您有所帮助,但我们始终都会使用此组件创建者。它为我们节省了一大笔时间来设置最初的文件结构..我知道你知道痛苦..任何与Joomla合作的人都可以:)。 http://www.notwebdesign.com/joomla-component-creator/。 – dcasadevall 2013-03-04 00:44:55