Jump to content

A simple page menu for permapages...


Stefan Konno

Recommended Posts

I bet this has been asked and answered hundred of times, but I for one can't get this right. I come from a strong programming background and I've worked with some CMS'es before such as Wordpress. All I'm trying to accomplish is to create a few links, a menu per se and place this menu in what ever place suitable.

Products
About
Contact

And I can't for the life of me figure out how to do this. So far I've come up with Tools > CMS, and then create pages there. But how do I either create them in separate categories, and how do I call them, is there any function like list_pages(); that creates a

  • or something?

    I've found that I can hack my way through the core in a module called blockpermanentlinks, but it's feel pretty stupid to hack the core the first thing I do, since I'd like to update the platform.

    So the third alternative becomes finding a third party module for this, but do I really have to do that? Thanks in advance.
Link to comment
Share on other sites

I'm sorry to bother you further, but I found something called Link Block, this gives me the possibility to create links as I want, but I have to hardcode the url, which isn't that great.

I found the permanent link block, it shows sitemap, contact and bookmark, but I can't figure out how to add/remove links from it. The only way I see is to hack the core code of the module which also isn't an option. Would you mind elaborate a bit on how to edit this block, or any other block for that matter. Some of them has an "Configure" button, but most don't.

I'd really appreciate the help, thanks in advance.

Link to comment
Share on other sites

Yeah you're right, it does what I asked for so thank you. :) But let's say I migrate the project to another url and server, then I have to rewrite those urls, which is quite annoying. Anyway, I'm also trying to edit the modules or theme files. I've tried modify just a bit of code in the modules directory for the blockpermanentlinks module, but nothing happens when I edit files there.

I also followed a guide to create a modules directory with a blockpermanentlinks directory in it, and copy the .tpl file there and edit it from there, to override the other one (so I don't hack the core) but nothing happens when I edit code in there as well. Do I have to recompile the tpl files some how or is this totally unexcepted behavoir? Maybe I should reinstall the whole project, I'm working on localhost if that's any help.

Link to comment
Share on other sites

OK, to make it so you can edit them in a config file .vs having to do it in the back office.

Make these changes to blocklink.php, comment out these lines:

elseif (!Validate::isUrl(str_replace('http://', '', $_POST['url'])))
 $this->_html .= $this->displayError($this->l('Bad URL'));


(there are 2 of them)
and

elseif (!empty($_POST['title_url']) AND !Validate::isUrl(str_replace('http://', '', $_POST['title_url'])))
   $this->_html .= $this->displayError($this->l('The field "title_url" is invalid'));


(there is only one)

Not in blocklink.php, hookLeftColumn() function.
add this line:

   include('mylinks.php');


before this line:

if (!$links)



Then you can open the Block Link configuration in the back office and put a Smarty variables for your URLs.
see image.

The file mylinks.php would look like this:

<?php
 global $smarty;
 $smarty->assign('my_link1', 'mypage.php');
?>

40584_Mfh6IxZNQHAD6EThoGOe_t

Link to comment
Share on other sites

You can group CMS pages in 1.4, then displaying the category lets you list the pages within the group how you want, albeit as a "page" of links, not a list you can use anywhere. I'm sure it would be easy enough to create a configurable module to list the links in a group though.

I've been playing with creating "plugins" for smarty to aid theme development and am working on a framework to easily allow people to add their own. I guess an analog in Wordpress would be the theme functions (functions.php). Generating a ul from the links in a CMS category might be a good one to look at implementing.

It would then be a case of using something like:

{list_pages cat='2'}



Anywhere in your theme you like, and it would generate the markup.

Paul

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...