Author |
Message |
hanscom
Hangin' Around
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Oct 16, 2003
Posts: 36
|
Posted:
Fri Apr 06, 2007 8:02 am |
|
Hi,
Is it possible to disable the link of the current page with javascript?
The link is in block-Test.php and the current page is in the Nuke Theme.
Regards,
Hans |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
kguske
Site Admin
![](modules/Forums/images/avatars/41f0b40a419280935f3a0.gif)
Joined: Jun 04, 2004
Posts: 6437
|
Posted:
Fri Apr 06, 2007 11:40 am |
|
Do you mean if you have a block with links, and one of the links is the current page, to not show the link?
If so, you might be better off using PHP to do that. |
_________________ I search, therefore I exist...
Only registered users can see links on this board! Get registered or login! |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
hanscom
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri Apr 06, 2007 2:28 pm |
|
Yes, I have a block with several images that act as links. But if if one of the links is the current page, I don't want the image link to disappear, but become 'unclickable'.
Is it easier to accomplish this by using php? Can you give me a hint?
Thanks in advance,
Hans |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
gregexp
The Mouse Is Extension Of Arm
![](modules/Forums/images/avatars/458c161744a70db912a6e.jpg)
Joined: Feb 21, 2006
Posts: 1497
Location: In front of a screen....HELP! lol
|
Posted:
Fri Apr 06, 2007 2:58 pm |
|
Well, if opinions are desired : PHP can be much better suited to do this rather then Javascript as PHP is server side, that means user cant disable it.
Heres a quick tip:
lets say I have a link to forums.html in a block:
$url=$_SERVER['PHP_SELF'];
//$url is now the url of the call, without the http://yoursite.blah/
//Now we will search the url and tell it what to do if it doesnt find what we are looking for.
if (!eregi('forums[.]html',$url)){
echo "link that works because we didnt find forums.html in the url";
}else{
echo "link that doesnt work because we found it";
}
I left the brackets in place for a reason, yes it will work without them, but its better practice with characters that are not letters or numbers to treat them this way. I have also found that telling it to make sure that it does NOT find it works on more occasions then telling it to look for something.
More or less a personal preference. |
_________________ For those who stand shall NEVER fall and those who fall shall RISE once more!! |
|
![ICQ Number ICQ Number](themes/RavenIce/forums/images/lang_english/icon_icq_add.gif) |
![](themes/RavenIce/forums/images/spacer.gif) |
hanscom
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sat Apr 07, 2007 3:40 am |
|
In my case the block-Welcome.php contains:
<?php
if (eregi("block-Welcome.php",$PHP_SELF)) {
Header("Location: index.php");
die();
}
$content .="<a href=\"index.php\" title=\"To Starting Page\"><img src=\"logo.jpg\"></a>";
?>
How do I modify this to prevent loading the current page again with the tip of darklord? |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
montego
Site Admin
![](modules/Forums/images/avatars/0c0adf824792d6d341ef4.gif)
Joined: Aug 29, 2004
Posts: 9457
Location: Arizona
|
Posted:
Sat Apr 07, 2007 8:33 am |
|
I think we have to know more about you mean exactly by "current page". Are you linking to various modules, or are you within a module and it is producing pages and this is where you want this block to respond to? Also, give more examples of the links so we can get a better idea of what you are wanting to do. |
_________________ Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
hanscom
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sat Apr 07, 2007 9:07 am |
|
Ok, my website is www.la-causerie.com and in the modules folder I have a
subfolder Html with several html pages. Some blocks link to those pages.
The main page when entering the site is in Dutch text. The 3rd flag (Dutch) also
links to the main page(index.php). When the main page is visible I want the link
of the Dutch flag to be disabled but still visible. If possible the same with the
other blocks when their linked pages are visible.
The code for the Dutch flag block is:
<p align="center">
<a href="index.php"> <img border="0" src="LaCauserie/holflag.jpg">
And the code for the other flags:
<p align="center">
<a href="modules.php?name=Html
&page=eng-text.html"> <img border="0" src="LaCauserie/engflag.jpg">
I hope this info will help.
Regards, Hans |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
hanscom
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Apr 10, 2007 3:44 am |
|
Another idea.
I want to change the content of a block by updating the mysql table, but nothing
happens and I get no errors. Is there somethig wrong with the script?
The script:
<?php
$con = mysql_connect("localhost","root","xxxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("nuke", $con);
mysql_query("UPDATE nuke_blocks SET content = '<img src='logo.jpg'>' WHERE title = 'Logo'");
mysql_close($con);
?>
Hans |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
evaders99
Former Moderator in Good Standing
![](modules/Forums/images/avatars/803d73f6452557b947721.jpg)
Joined: Apr 30, 2004
Posts: 3221
|
Posted:
Tue Apr 10, 2007 9:19 pm |
|
If this is in the Nuke database, just use the Nuke database connections
|
_________________ - Only registered users can see links on this board! Get registered or login! -
Need help? Only registered users can see links on this board! Get registered or login! |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
hanscom
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Apr 11, 2007 2:33 am |
|
Sorry, I don't understand.
Can you give an example to update a table?
TIA |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
evaders99
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Apr 11, 2007 4:38 pm |
|
Code:
include_once("mainfile.php");
$db->sql_query("UPDATE nuke_blocks SET content = '<img src='logo.jpg'>' WHERE title = 'Logo'");
|
If this is a standalone file, in the nuke root folder, that is all the code you need. Nuke should set up the correct database connection and you just need to use $db->sql_query instead of mysql_query |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
|