PHP Web Host - Quality Web Hosting For All PHP Applications Free RavenNuke(tm) Add Ons
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
washbucket
Hangin' Around


Joined: Jul 17, 2007
Posts: 39
Location: colorado

PostPosted: Sun Feb 17, 2008 7:27 am Reply with quote Back to top

I looked through all the modules to find the answer, I just need a module that will link to my photo gallery which is a separate program from my website, so if I have gallery listed under my modules it will link to it's url. for say
Only registered users can see links on this board!
Get registered or login to the forums!
when clicked on. thanks
View user's profile Send private message Send e-mail Visit poster's website
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sun Feb 17, 2008 7:49 am Reply with quote Back to top

There are several ways. A simple way would be to add a module with this code. Save this code as index.php in the folder of whatever you name your module. Then ftp it to your modules folder and activate it through your Admin Control Panel.

Note: I have changed the Topic/Subject to better describe this Wink

Code:

<?php
if (!defined('MODULE_FILE'))
{
   die('You can\'t access this file directly...');
}
header('Location: http://www.website.com/gallery');
die();
?>
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
washbucket
Hangin' Around


Joined: Jul 17, 2007
Posts: 39
Location: colorado

PostPosted: Sun Feb 17, 2008 8:17 am Reply with quote Back to top

Thank you for the help.
View user's profile Send private message Send e-mail Visit poster's website
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sun Feb 17, 2008 10:26 am Reply with quote Back to top

RavensScripts
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
bprsk8r4272
Regular
Regular


Joined: Jan 23, 2007
Posts: 96
Location: Rochester, Ny

PostPosted: Sun Feb 17, 2008 12:35 pm Reply with quote Back to top

ahh perfect i was wondering how to do the same thing thanks
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
rjms
Regular
Regular


Joined: Feb 10, 2012
Posts: 56

PostPosted: Mon Feb 13, 2012 4:12 am Reply with quote Back to top

and what to do to make the one who clicks it go to _blank instaed of _self ?
View user's profile Send private message
killing-hours
RavenNuke(tm) Development Team


Joined: Oct 01, 2010
Posts: 415
Location: Houston, Tx

PostPosted: Mon Feb 13, 2012 9:09 am Reply with quote Back to top

rjms wrote:
and what to do to make the one who clicks it go to _blank instaed of _self ?




Quote:
You can't. PHP is a server-side language, it cannot control the browser. Use Javascript or HTML.

Only registered users can see links on this board!
Get registered or login to the forums!


You will need to modify the way the link is presented to the user.
View user's profile Send private message
spasticdonkey
RavenNuke(tm) Development Team


Joined: Dec 02, 2006
Posts: 1364
Location: Texas, USA

PostPosted: Mon Feb 13, 2012 10:05 am Reply with quote Back to top

If you don't want to get into adding php logic to your block, you could use JavaScript to target to address of your link.

Code:
$NewWindow = '<script type="text/javascript">
$("a[href$=\'mysite.com/mygallery.html\']").attr("target", "_blank");
</script>';
addJSToBody($NewWindow, 'inline');


This could be added to any block, just replace mysite.com/mygallery.html with how your link ENDS. Include enough of the address to ensure it will be unique, so the attribute will not be appended to other links. You could also use:
link begins with this string
a[href^=\'http://www.ravenphpscripts.com\']
link contains this string somewhere within the URL
a[href*=\'ravenphpscripts\']

** this assumes you are running at least ravennuke 2.4+
View user's profile Send private message
rjms
Regular
Regular


Joined: Feb 10, 2012
Posts: 56

PostPosted: Mon Feb 13, 2012 12:59 pm Reply with quote Back to top

I am using standard 8.2 nuke,

My best bet is to use JScript though, can you explain where to put what text and if I need to make a whole new Java Script to make this work?
View user's profile Send private message
spasticdonkey
RavenNuke(tm) Development Team


Joined: Dec 02, 2006
Posts: 1364
Location: Texas, USA

PostPosted: Mon Feb 13, 2012 1:45 pm Reply with quote Back to top

I don't have any familiarity with standard nuke (other than recommending people not use it Surprised )

While we are always glad to help, the fact they have no support and you have to ask questions here should tell you something about php-nuke.. Not to mention the
Only registered users can see links on this board!
Get registered or login to the forums!
Smile

OK, back to it, assuming your block uses $content something like this at the end of your block should work.

Code:
$content .= '<script type="text/javascript">
$("a[href$=\'mysite.com/mygallery.html\']").attr("target", "_blank");
</script>';


Although this requires jquery which I don't know if 8.2 uses.. Rolling Eyes If it does not you are stuck coming up with a pure JavaScript solution or including jquery yourself. At that point it is probably less work to edit the block file and add logic to add the attribute via php. If you post back with your blockfile code we can probably come up with something.
View user's profile Send private message
rjms
Regular
Regular


Joined: Feb 10, 2012
Posts: 56

PostPosted: Tue Feb 14, 2012 4:15 am Reply with quote Back to top

You are right about the lack of support at phpnuke, however, if I upgrade to Raven Nuke I will most probably lose all I have now right?


The block i use now:

Code:

<?php

if (!eregi("modules.php", $PHP_SELF)) {
die ("You can't access this file directly...");
}

$index = 0;   // 0 : do not show right blocks - 1:show right blocks
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));

include("header.php");


header('location:http://www.xdppxclan.co.uk/');

?>
View user's profile Send private message
rjms
Regular
Regular


Joined: Feb 10, 2012
Posts: 56

PostPosted: Tue Feb 14, 2012 4:19 am Reply with quote Back to top

the code i use now (the edit does not do anything it seems)

Code:

<?php

if (!eregi("modules.php", $PHP_SELF)) {
die ("You can't access this file directly...");
}

$index = 0;   // 0 : do not show right blocks - 1:show right blocks
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));

include("header.php");


header('location:http://www.xdppxclan.co.uk/');

?>
View user's profile Send private message
Dawg
RavenNuke(tm) Development Team


Joined: Nov 07, 2003
Posts: 889

PostPosted: Tue Feb 14, 2012 5:31 am Reply with quote Back to top

rjms,

There are SOOO many holes in regular php-nuke that you are going to lose everything if you don't change becasue you will get hacked.

I have not looked at the database for 8.2 but I there are compare files in the RN installer to compare database tables. Most likely you would not lose everything. It might take some work to get it up and running but it can be done.

The support staff here is very good.

RN is Safe, Secure and has an active support staff. If you are going to stay with Nuke in general...you should bite the bullet and do the change over and be done with it.

Just my .02

Dawg
View user's profile Send private message
unicornio
Involved
Involved


Joined: Aug 13, 2009
Posts: 432

PostPosted: Tue Feb 14, 2012 5:52 am Reply with quote Back to top

Module

Code:
<?php

if (!defined('MODULE_FILE')) {
   die ("You can't access this file directly...");
}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
include("header.php");
define('INDEX_FILE', true);
OpenTable();
echo"$NewWindow = '<script type=\"text/javascript\">"
  . "(\"a[href$=\\'mysite.com/mygallery.html\\']\").attr(\"target\", \"_blank\");"
  . "/script>';"
  . "ddJSToBody($NewWindow, 'inline');";
CloseTable();
include("footer.php");

?>


block

Code:
<?php

if ( !defined('BLOCK_FILE') ) {
    Header("Location: ../index.php");
    die();
}
$content .= '<script type="text/javascript">
$("a[href$=\'mysite.com/mygallery.html\']").attr("target", "_blank");
</script>';
?>
View user's profile Send private message
bobbyg
Worker
Worker


Joined: Dec 05, 2007
Posts: 201
Location: Tampa, Florida

PostPosted: Tue Feb 14, 2012 12:24 pm Reply with quote Back to top

html redirect

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Your Page Title</title>
<meta http-equiv="REFRESH" content="0;url=http://www.site=you-want-to-redirct-to.com"></HEAD>
<BODY>
Optional page text here.
</BODY>
</HTML>
View user's profile Send private message Visit poster's website
rjms
Regular
Regular


Joined: Feb 10, 2012
Posts: 56

PostPosted: Tue Feb 14, 2012 12:41 pm Reply with quote Back to top

thanks guys Razz

Is there a manual too to upgrade standard nuke (8.2) to Raven Nuke somewhere?

Got the block working with JQuery btw Smile
View user's profile Send private message
spasticdonkey
RavenNuke(tm) Development Team


Joined: Dec 02, 2006
Posts: 1364
Location: Texas, USA

PostPosted: Tue Feb 14, 2012 3:24 pm Reply with quote Back to top

I would start with:
Only registered users can see links on this board!
Get registered or login to the forums!


then
UtilityFiles/table_compare/readme.txt

which is included in the distro. Get your tables to match and you should be good to go Smile

If you have questions just post back. Glad you got the jquery solution working Wink
View user's profile Send private message
rjms
Regular
Regular


Joined: Feb 10, 2012
Posts: 56

PostPosted: Sat Feb 18, 2012 6:06 am Reply with quote Back to top

Allright.. I finally upgraded to RN 2.5 Smile but now the module/block to redirect isn't working anymore Sad I will start a new topic about this cuase I do not want to spam this one any longer.
View user's profile Send private message
rjms
Regular
Regular


Joined: Feb 10, 2012
Posts: 56

PostPosted: Sat Feb 18, 2012 6:17 am Reply with quote Back to top

On the other hand... this is sticky so it might be usefull for others too to see a result Smile
View user's profile Send private message
spasticdonkey
RavenNuke(tm) Development Team


Joined: Dec 02, 2006
Posts: 1364
Location: Texas, USA

PostPosted: Sat Feb 18, 2012 10:02 am Reply with quote Back to top

so the link is opening in a new window, but is not redirecting?

If so make sure your module file looks like Raven's example, I noticed your posted example was different.

If the new window is not opening refer to my first example since you are running RavenNuke now Smile

Depending on which block and/or menu you are adding the link to, there are ways to avoid JavaScript usage, if desired.
View user's profile Send private message
rjms
Regular
Regular


Joined: Feb 10, 2012
Posts: 56

PostPosted: Sat Feb 18, 2012 10:45 am Reply with quote Back to top

I took the exact code unicorno stated for the module, replaced my site off interrest of course Smile when I click it it opens in the same window still and gives a 404, "_target" not found on this server
View user's profile Send private message
rjms
Regular
Regular


Joined: Feb 10, 2012
Posts: 56

PostPosted: Sat Feb 18, 2012 10:48 am Reply with quote Back to top

Code:

<?php

if (!defined('MODULE_FILE')) {
   die ("You can't access this file directly...");
}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
include("header.php");
define('INDEX_FILE', true);
OpenTable();
echo"$NewWindow = '<script type=\"text/javascript\">"
  . "(\"a[href$=\\'xdppxclan.co.uk\\']\").attr(\"target\", \"_blank\");"
  . "/script>';"
  . "ddJSToBody($NewWindow, 'inline');";
CloseTable();
include("footer.php");

?
View user's profile Send private message
spasticdonkey
RavenNuke(tm) Development Team


Joined: Dec 02, 2006
Posts: 1364
Location: Texas, USA

PostPosted: Sat Feb 18, 2012 12:56 pm Reply with quote Back to top

there is some missing code in that example. Use the code raven posted in the second post in this thread.

If you still need to add the javascript to add the target blank attribute, see my first post in this thread. Add that to the block in question, on a new line, before the closing ?>
View user's profile Send private message
fkelly
Moderator


Joined: Aug 30, 2005
Posts: 3186
Location: near Albany NY

PostPosted: Sat Feb 18, 2012 4:17 pm Reply with quote Back to top

While making a module serve as a link should work, you might want to consider other approaches as well. Like for instance, if you have an opening message at the top of your web page just put the link in there using the links editor and some prominent fonts and positioning. Or even create a block that has nothing in it but the link to your Gallery and position that center top using the blocks editor. Or add a sample picture to such a block to illustrate what you are pointing them to.

Creating a pseudo-module seems like a long way around the block to me.
View user's profile Send private message Visit poster's website
rjms
Regular
Regular


Joined: Feb 10, 2012
Posts: 56

PostPosted: Sat Feb 18, 2012 5:07 pm Reply with quote Back to top

spasticdonkey wrote:
there is some missing code in that example. Use the code raven posted in the second post in this thread.

If you still need to add the javascript to add the target blank attribute, see my first post in this thread. Add that to the block in question, on a new line, before the closing ?>


If I use that code it opens in the same window, and scrambles my home.
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum