Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules
Author Message
washbucket
Hangin' Around


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

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

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! 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: 17086

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

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
washbucket
PostPosted: Sun Feb 17, 2008 8:17 am Reply with quote

Thank you for the help.
 
Raven
PostPosted: Sun Feb 17, 2008 10:26 am Reply with quote

RavensScripts
 
bprsk8r4272
Regular
Regular


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

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

ahh perfect i was wondering how to do the same thing thanks

_________________
Only registered users can see links on this board! Get registered or login! 
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

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: 438
Location: Houston, Tx

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

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!

You will need to modify the way the link is presented to the user.

_________________
Money is the measurement of time - Me
"You can all go to hell…I’m going to Texas" -Davy Crockett 
View user's profile Send private message
spasticdonkey
RavenNuke(tm) Development Team


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

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

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 Visit poster's website
rjms
PostPosted: Mon Feb 13, 2012 12:59 pm Reply with quote

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
PostPosted: Mon Feb 13, 2012 1:45 pm Reply with quote

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! 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.
 
rjms
PostPosted: Tue Feb 14, 2012 4:15 am Reply with quote

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
PostPosted: Tue Feb 14, 2012 4:19 am Reply with quote

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: 910

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

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
hicuxunicorniobestbuildpc
Life Cycles Becoming CPU Cycles


Joined: Aug 13, 2009
Posts: 967
Location: Netherland

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

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 Visit poster's website
bobbyg
Worker
Worker


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

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

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
PostPosted: Tue Feb 14, 2012 12:41 pm Reply with quote

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
 
spasticdonkey
PostPosted: Tue Feb 14, 2012 3:24 pm Reply with quote

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

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
 
rjms
PostPosted: Sat Feb 18, 2012 6:06 am Reply with quote

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.
 
rjms
PostPosted: Sat Feb 18, 2012 6:17 am Reply with quote

On the other hand... this is sticky so it might be usefull for others too to see a result Smile
 
spasticdonkey
PostPosted: Sat Feb 18, 2012 10:02 am Reply with quote

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.
 
rjms
PostPosted: Sat Feb 18, 2012 10:45 am Reply with quote

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
 
rjms
PostPosted: Sat Feb 18, 2012 10:48 am Reply with quote

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
PostPosted: Sat Feb 18, 2012 12:56 pm Reply with quote

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
Former Moderator in Good Standing


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

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

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
PostPosted: Sat Feb 18, 2012 5:07 pm Reply with quote

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.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules

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
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©