| Author |
Message |
washbucket Hangin' Around

Joined: Jul 17, 2007 Posts: 39 Location: colorado
|
Posted:
Sun Feb 17, 2008 7:27 am |
|
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 when clicked on. thanks |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Sun Feb 17, 2008 7:49 am |
|
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
| Code: |
<?php
if (!defined('MODULE_FILE'))
{
die('You can\'t access this file directly...');
}
header('Location: http://www.website.com/gallery');
die();
?> |
|
|
|
|
 |
washbucket Hangin' Around

Joined: Jul 17, 2007 Posts: 39 Location: colorado
|
Posted:
Sun Feb 17, 2008 8:17 am |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Sun Feb 17, 2008 10:26 am |
|
|
|
 |
bprsk8r4272 Regular


Joined: Jan 23, 2007 Posts: 96 Location: Rochester, Ny
|
Posted:
Sun Feb 17, 2008 12:35 pm |
|
ahh perfect i was wondering how to do the same thing thanks |
|
|
|
 |
rjms Regular


Joined: Feb 10, 2012 Posts: 56
|
Posted:
Mon Feb 13, 2012 4:12 am |
|
and what to do to make the one who clicks it go to _blank instaed of _self ? |
|
|
|
 |
killing-hours RavenNuke(tm) Development Team

Joined: Oct 01, 2010 Posts: 415 Location: Houston, Tx
|
Posted:
Mon Feb 13, 2012 9:09 am |
|
| 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. |
You will need to modify the way the link is presented to the user. |
|
|
|
 |
spasticdonkey RavenNuke(tm) Development Team

Joined: Dec 02, 2006 Posts: 1364 Location: Texas, USA
|
Posted:
Mon Feb 13, 2012 10:05 am |
|
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+ |
|
|
|
 |
rjms Regular


Joined: Feb 10, 2012 Posts: 56
|
Posted:
Mon Feb 13, 2012 12:59 pm |
|
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? |
|
|
|
 |
spasticdonkey RavenNuke(tm) Development Team

Joined: Dec 02, 2006 Posts: 1364 Location: Texas, USA
|
Posted:
Mon Feb 13, 2012 1:45 pm |
|
I don't have any familiarity with standard nuke (other than recommending people not use it )
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
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.. 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. |
|
|
|
 |
rjms Regular


Joined: Feb 10, 2012 Posts: 56
|
Posted:
Tue Feb 14, 2012 4:15 am |
|
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/');
?>
|
|
|
|
|
 |
rjms Regular


Joined: Feb 10, 2012 Posts: 56
|
Posted:
Tue Feb 14, 2012 4:19 am |
|
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/');
?>
|
|
|
|
|
 |
Dawg RavenNuke(tm) Development Team

Joined: Nov 07, 2003 Posts: 889
|
Posted:
Tue Feb 14, 2012 5:31 am |
|
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 |
|
|
|
 |
unicornio Involved


Joined: Aug 13, 2009 Posts: 432
|
Posted:
Tue Feb 14, 2012 5:52 am |
|
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>';
?> |
|
|
|
|
 |
bobbyg Worker


Joined: Dec 05, 2007 Posts: 201 Location: Tampa, Florida
|
Posted:
Tue Feb 14, 2012 12:24 pm |
|
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> |
|
|
|
 |
rjms Regular


Joined: Feb 10, 2012 Posts: 56
|
Posted:
Tue Feb 14, 2012 12:41 pm |
|
thanks guys
Is there a manual too to upgrade standard nuke (8.2) to Raven Nuke somewhere?
Got the block working with JQuery btw  |
|
|
|
 |
spasticdonkey RavenNuke(tm) Development Team

Joined: Dec 02, 2006 Posts: 1364 Location: Texas, USA
|
Posted:
Tue Feb 14, 2012 3:24 pm |
|
I would start with:
then
UtilityFiles/table_compare/readme.txt
which is included in the distro. Get your tables to match and you should be good to go
If you have questions just post back. Glad you got the jquery solution working  |
|
|
|
 |
rjms Regular


Joined: Feb 10, 2012 Posts: 56
|
Posted:
Sat Feb 18, 2012 6:06 am |
|
Allright.. I finally upgraded to RN 2.5 but now the module/block to redirect isn't working anymore I will start a new topic about this cuase I do not want to spam this one any longer. |
|
|
|
 |
rjms Regular


Joined: Feb 10, 2012 Posts: 56
|
Posted:
Sat Feb 18, 2012 6:17 am |
|
On the other hand... this is sticky so it might be usefull for others too to see a result  |
|
|
|
 |
spasticdonkey RavenNuke(tm) Development Team

Joined: Dec 02, 2006 Posts: 1364 Location: Texas, USA
|
Posted:
Sat Feb 18, 2012 10:02 am |
|
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
Depending on which block and/or menu you are adding the link to, there are ways to avoid JavaScript usage, if desired. |
|
|
|
 |
rjms Regular


Joined: Feb 10, 2012 Posts: 56
|
Posted:
Sat Feb 18, 2012 10:45 am |
|
I took the exact code unicorno stated for the module, replaced my site off interrest of course when I click it it opens in the same window still and gives a 404, "_target" not found on this server |
|
|
|
 |
rjms Regular


Joined: Feb 10, 2012 Posts: 56
|
Posted:
Sat Feb 18, 2012 10:48 am |
|
| 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");
?
|
|
|
|
|
 |
spasticdonkey RavenNuke(tm) Development Team

Joined: Dec 02, 2006 Posts: 1364 Location: Texas, USA
|
Posted:
Sat Feb 18, 2012 12:56 pm |
|
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 ?> |
|
|
|
 |
fkelly Moderator

Joined: Aug 30, 2005 Posts: 3186 Location: near Albany NY
|
Posted:
Sat Feb 18, 2012 4:17 pm |
|
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. |
|
|
|
 |
rjms Regular


Joined: Feb 10, 2012 Posts: 56
|
Posted:
Sat Feb 18, 2012 5:07 pm |
|
| 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. |
|
|
|
 |
|
|
|
|