Jump to content

links in footer area


pwusr
 Share

Recommended Posts

I need to keep about 4-5 columns of links in my footer area / or in another div just above the footer.

Each column will have a header and 4-5 links below it. All these are links to pages but in random order.

Kindly let me know how I should go about it.

Thanks a lot.

Link to comment
Share on other sites

You could use a repeater field with inside:

  1. title
  2. input type Page (Multiple pages (PageArray) - Input field type AsmSelect)

Then the amount of repeater items would be the amount of columns.

( for columns width, calculate the percentage, easiest to use inline style for it. )

So the title would become the header, each repeater field could output the url for pages you selected.

Link to comment
Share on other sites

Thanks a lot for your quick reply,  @Martijn.

I have created the repeater field as you suggested. I have a doubt regarding Selectable Pages field. If I select Home I can't see the children of the pages coming under Home page. (For ex: Children of About Us - The team, Gallery etc - are not visible. )

Then the amount of repeater items would be the amount of columns.

So, does this mean I have to create 5 different repeater fields (each with title and set of links) if I have 5 columns of links?

This has to be available on all pages, so do I create a template for this (set of links)

Thanks in advance.

Link to comment
Share on other sites



If you want this to set on all pages individually you could do this if you have a small amount of pages. But this approach is bad for scaleability. ( I don't think you should do this for 10 pages + ) You could however, set a default approach. On possible way to archief:
 
- add your repeater field to the home template.
- then add the field to your let say "basic template" 
 
$homepage = $pages->get('/');
$repeater = count($page->repeater) ? $page->repeater : $homepage->repeater;
Then foreach your $repeater, beware that you have to foreach your pages array inside the repeater items to.
 
 
So, if there are no repeater rows in the basic-page, the footer links set in the homepage is used. 
 
- repeater field

  - repeater-item // represets a column 
    - title
    - fieldtype page ( array )
      * page selected
      * page selected
      * page selected
      * an other page selected )

  - repeater-item // represets an other column 
    - title
    - fieldtype page ( array )
      * page selected
      * page selected
      * page selected
      * an other page selected )

  - repeater-item
    - title
      - fieldtype page ( array )
        * page selected
        * page selected
        * page selected
        * an other page selected )
etc....

* code blocks works funky in editor (chrome / mac / Version 24.0.1312.56)

Edited by Martijn Geerts
Link to comment
Share on other sites

Thanks @Martjin for your detailed reply.

But being a newbie I couldn't understand some parts clearly.

I don't think you should do this for 10 pages +

I do have more than 10 pages - around 20

I have some basic doubts also:

a)What should I select in the Selectable Pages (in the fields  section)

   (If I select Home I can't see the children of the pages coming under Home page.)

b) Do I have to create say, 5 different repeater fields if I have 5 columns of links?

Thanks again.

Link to comment
Share on other sites

I Think you should use a default so you don't have to set the urls on every page you create.

a. The Selectable Pages you should select the pages where you want to have the link to.

b. you need one repeater, in wich you can create for example 5 repeter-items.

    ( Every repeater-item then contains a title for your header and an array of pages for your list of links  )

    (So basicly every "row" is a column)

    ( You have to foreach the pages array inside the repeater to, and output the individual page )

Link to comment
Share on other sites

Thank you.

I Think you should use a default so you don't have to set the urls on every page you create.

So maybe I should have for ex: a pagelinks.inc (like foot.inc) and include it in every file.

you need one repeater, in wich you can create for example 5 repeter-items.

How to create repeater-items within a repeater field.

I tried but couldnt.

As each repeater-item contains title and (links to) few pages they should be type repeater, if I am not mistaken.

Please correct me if I am wrong. Thanks.

Link to comment
Share on other sites

Thanks a lot.. I got that & I had also watched the excellent video by Ryan.

Created Repeater field with Title & Page type fields.

But I am slightly confused by this:

you need one repeater, in wich you can create for example 5 repeter-items.

    ( Every repeater-item then contains a title for your header and an array of pages for your list of links  )

According to the above:

There is one Repeater field

Each Repeater has for ex: 5 Repeater Items

Each Repeater Items has a Title + Page (Array)

Thank you for your patience.

  • Like 1
Link to comment
Share on other sites

yep, the structure I've drawn in the 4th post.


$repeater = $page->repeater; // assumed that your repeater called: repeater
$count = (int) count($repeater); // amount of columns
$percentage =  round((100 / $count), 5); // round the percentage
 
if($count) {
    foreach($repeater as $item) {
 
        echo "<div style='float: left; width: {$percentage}%;'>\n";
        echo "\t<h4>{$item->title}</h4>\n";
 
        if(count($item->pages)) {
            echo "\t<ul>\n";
            // if the fieldtype page is called pages
            foreach($item->pages as $p) { 
                echo "\t\t<li><a href='{$p->url}'>{$p->title}</a></li>\n"; 
            } 
            echo "\t</ul>\n"; 
        } 
        
        echo "</div>\n";
    }
}
Link to comment
Share on other sites

Sorry for not making myself clear.

In my repeater field I have a page (array) field .

My website has the following structure

-Home

-About Us

   --Sub menu 1

   --Sub menu 2

-Main Menu 3

-Main Menu 4

   --Sub Menu 1

etc.

On the page when I enter data for the repeater, the page field list shows only Top level pages ie., Home, About Us, Main Menu 3, Main Menu 4 etc.

I cannot see (or select) the subpages.

Home is selected as parent of selectable pages.

How can I make the sub pages also available (in the list) to select them.

Hope I have made myself clear.

Thanks a lot.

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...