Skip to content
This repository has been archived by the owner on Sep 14, 2022. It is now read-only.

How to override footer links on per page basis #160

Closed
BerkeleyEdu opened this issue Aug 31, 2012 · 6 comments
Closed

How to override footer links on per page basis #160

BerkeleyEdu opened this issue Aug 31, 2012 · 6 comments

Comments

@BerkeleyEdu
Copy link

Hi,

In MWF 1.2 I set the link in the footer to current file to blank so that it would not be underlined or linked. This is done for usability.

$footer->set_contact('', '');
echo $footer->render();

but this no longer works because all of the footer links are in one array (private $_footer_link_urls) whereas before they we separate (private $_contact_url = '/contact';) so, how can I get this functionality back?

-Sara

@ebollens
Copy link
Contributor

I'm a bit confused what you mean by "in the footer to current file to blank so that it would not be underlined or linked"

As for front page links, you can control them in config/global.ini.

@BerkeleyEdu
Copy link
Author

For example on the production site, the footer in the Contact page does
not have a the "Contact" in the footer as a hot link:

http://m.berkeley.edu/contact/

Linking to the current page is considered bad for usability.

-Sara

On 8/31/2012 4:54 PM, Eric Bollens wrote:

I'm a bit confused what you mean by "in the footer to current file to
blank so that it would not be underlined or linked"

As for front page links, you can control them in |config/global.ini|.


Reply to this email directly or view it on GitHub
#160 (comment).

Sara Leavitt, Electronic Communications Specialist
UC Berkeley Office of Public Affairs
2200 Bancroft Way, Berkeley, CA 94720-4204
Phone: 510 643-6163
http://events.berkeley.edu
http://www.berkeley.edu/mobile

@ebollens
Copy link
Contributor

ebollens commented Sep 1, 2012

To change this, you'd need to override the class Default_Footer_Site_Decorator with your own that has custom behaviors. You could simply program it to use the old method instead.

@Trott
Copy link
Contributor

Trott commented Sep 1, 2012

Untested, but if you know the URL you want to remove from the footer (but leave the associated text intact), I think you'd do something like this prior to rendering the footer:

function remove_link( $title ) {
    $footer_link_titles = Config::get('global', 'footer_link_titles');
    $footer_link_urls = Config::get('global', 'footer_link_urls');
    $found = array_search($title, $footer_link_titles);
    if ($found !== FALSE) {
        unset($footer_link_urls[$found]);
    }
   Config::set('global', 'footer_link_urls', $footer_link_urls);
}

I'm pretty sure that, or something very close to that, should work. Like I said, untested, sorry. But calling remove_link('Contact') before the render() call on the footer should remove the link (but leave the text).

@BerkeleyEdu
Copy link
Author

Hi Rich,

Thanks for the hint! The "unset" messed up the for loop in
*footer.class.php *so I set the link to 'link_removed' then test later
to see if a link should be rendered.

public function &remove_link( $title ) {
$found = array_search($title, $this->_footer_link_titles);
if ($found !== FALSE) {
$this->_footer_link_urls[$found] = 'link_removed';
}
return $this;
}
...
for ($i = 0; $i < count($this->_footer_link_urls); $i++) {
if ($this->_footer_link_urls[$i] == 'link_removed')
{
$p->add_inner($this->_footer_link_titles[$i]);
}
else
{
$p->add_inner_tag('a',
$this->_footer_link_titles[$i], array('href' =>
$this->_footer_link_urls[$i]));

On 8/31/12 6:23 PM, Trott wrote:

Untested, but if you know the URL you want to remove from the footer
(but leave the associated text intact), I think you'd do something
like this prior to rendering the footer:

|function remove_link( $title ) {
$footer_link_titles = Config::get('global', 'footer_link_titles');
$footer_link_urls = Config::get('global', 'footer_link_urls');
$found = array_search($title, $footer_link_titles);
if ($found !== FALSE) {
unset($footer_link_urls[$found]);
}
Config::set('global', 'footer_link_urls', $footer_link_urls);
}
|

I'm pretty sure that, or something very close to that, should work.
Like I said, untested, sorry. But calling |remove_link('Contact')|
before the |render()| call on the footer should remove the link (but
leave the text).


Reply to this email directly or view it on GitHub
#160 (comment).

@rrocchio
Copy link
Contributor

Closing this issue as this system has long since been deprecated.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants