Page 1 of 1

open a link new window inserted into the page LINKS_HOME

Posted: 2015-01-21 23:00
by facos79
Hello, how do I open in a new window or a new tab link placed on the page LINKS_HOME?

Code: Select all

<?php
	/*
	 * You can add custom links in the home page by appending them here ...
	 * The format for each link is:*/
		$homeLinks[] = array(
			
			'url' => 'http://www.sitodiprova.net',
			'title' => 'Consulenza', 
			'description' => 'Consulente Tecnico Informatico',
			'groups' => array('all groups'), // groups allowed to see this link, use '*' if you want to show the link to all groups
			'grid_column_classes' => 'col-md-6 col-lg-4', // optional CSS classes to apply to link block. See: http://getbootstrap.com/css/#grid
			'panel_classes' => 'panel-danger', // optional CSS classes to apply to panel. See: http://getbootstrap.com/components/#panels
			'link_classes' => 'btn-danger', // optional CSS classes to apply to link. See: http://getbootstrap.com/css/#buttons
			'icon' => '/contratti-assistenza/ceo.png' // optional icon to use with the link
		);

Grazie per l'aiuto.

Re: open a link new window inserted into the page LINKS_HOME

Posted: 2015-01-22 07:21
by peebee
Insert this element into your array and you should be right. Works for me:

'target' => '_blank',

Re: open a link new window inserted into the page LINKS_HOME

Posted: 2015-01-23 00:33
by peebee
Edit to above. Sorry, just revisited this and see I forgot to mention you have to add the 'target' element to your generated home.php file

Find this code in home.php (around Line 71):

Code: Select all

<?php
		/* custom home links, as defined in "hooks/links-home.php" */
		if(is_array($homeLinks)){
			$memberInfo = getMemberInfo();
			foreach($homeLinks as $link){
				if(!isset($link['url']) || !isset($link['title'])) continue;
and replace with this:

Code: Select all

<?php
		/* custom home links, as defined in "hooks/links-home.php" */
		if(is_array($homeLinks)){
			$memberInfo = getMemberInfo();
			foreach($homeLinks as $link){
				if(!isset($link['url']) || !isset($link['title']) || !isset($link['target'])) continue;
Same process applies to nav-links. See here: http://forums.appgini.com/phpbb/viewtop ... rget#p3524

Re: open a link new window inserted into the page LINKS_HOME

Posted: 2015-01-23 11:38
by facos79
Grazie ;)

Re: open a link new window inserted into the page LINKS_HOME

Posted: 2015-12-23 20:03
by lexena
peebee wrote:Edit to above. Sorry, just revisited this and see I forgot to mention you have to add the 'target' element to your generated home.php file

Find this code in home.php (around Line 71):

Code: Select all

<?php
		/* custom home links, as defined in "hooks/links-home.php" */
		if(is_array($homeLinks)){
			$memberInfo = getMemberInfo();
			foreach($homeLinks as $link){
				if(!isset($link['url']) || !isset($link['title'])) continue;
and replace with this:

Code: Select all

<?php
		/* custom home links, as defined in "hooks/links-home.php" */
		if(is_array($homeLinks)){
			$memberInfo = getMemberInfo();
			foreach($homeLinks as $link){
				if(!isset($link['url']) || !isset($link['title']) || !isset($link['target'])) continue;
Same process applies to nav-links. See here: http://forums.appgini.com/phpbb/viewtop ... rget#p3524
Hi, I added the 'target' => '_blank', line to my links-home.php page and checked the home.php page for the code shown above but didn't find it. Is this because I am usinig the latest version of AppGini 5.50?? Please advise. I do know some PHP so I get I just need to know where it is located.

Thanks!
Lexe

Re: open a link new window inserted into the page LINKS_HOME

Posted: 2015-12-23 22:16
by lexena
I found one more Caveat....
In incCommon.php, add target="<?php echo $link['target']; ?> to line 1222. Please below:
BEFORE:

Code: Select all

<a class="btn btn-block btn-lg <?php echo $link['link_classes']; ?>" title="<?php echo preg_replace("/&(#[0-9]+|[a-z]+);/i", "&$1;", htmlspecialchars(strip_tags($link['description']))); ?>" <a href="<?php echo $link['url']; ?> &nbsp; target="<?php echo $link['target']; ?>"><?php echo ($link['icon'] ? '<img src="' . $link['icon'] . '">' : ''); ?><strong><?php echo $link['title']; ?></strong></a>
AFTER CHANGE:

Code: Select all

<a class="btn btn-block btn-lg <?php echo $link['link_classes']; ?>" target="<?php echo $link['target']; ?> title="<?php echo preg_replace("/&(#[0-9]+|[a-z]+);/i", "&$1;", htmlspecialchars(strip_tags($link['description']))); ?>" href="<?php echo $link['url']; ?>"><?php echo ($link['icon'] ? '<img src="' . $link['icon'] . '">' : ''); ?><strong><?php echo $link['title']; ?></strong></a>

Re: open a link new window inserted into the page LINKS_HOME

Posted: 2016-04-17 01:01
by gofigure
Ok so I cannot find the specified code in home.php or the other code in inCommon.php either. Has this changed with the latest release?

Re: open a link new window inserted into the page LINKS_HOME

Posted: 2016-04-17 23:33
by peebee
Code has changed for V5.50

Look in incCommon.php around line 1091 and 1218 and you will see this:

Code: Select all

if(!isset($link['url']) || !isset($link['title'])) continue;
change to this:

Code: Select all

if(!isset($link['url']) || !isset($link['title']) || !isset($link['target'])) continue;
The first instance is for Navigation links, second is for Home links.

I haven't actually tried it but that should do the job I think.