Ravens PHP Scripts: Forums
 

 

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



Joined: Oct 16, 2003
Posts: 36

PostPosted: Fri Apr 06, 2007 8:02 am Reply with quote

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
 
View user's profile Send private message
kguske
Site Admin



Joined: Jun 04, 2004
Posts: 6432

PostPosted: Fri Apr 06, 2007 11:40 am Reply with quote

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...
nukeSEO - nukeFEED - nukePIE - nukeSPAM - nukeWYSIWYG
 
View user's profile Send private message
hanscom







PostPosted: Fri Apr 06, 2007 2:28 pm Reply with quote

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
 
gregexp
The Mouse Is Extension Of Arm



Joined: Feb 21, 2006
Posts: 1497
Location: In front of a screen....HELP! lol

PostPosted: Fri Apr 06, 2007 2:58 pm Reply with quote

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 [ Only registered users can see links on this board! Get registered or login! ]
//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!! 
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
hanscom







PostPosted: Sat Apr 07, 2007 3:40 am Reply with quote

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?
 
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Sat Apr 07, 2007 8:33 am Reply with quote

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.

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
hanscom







PostPosted: Sat Apr 07, 2007 9:07 am Reply with quote

Ok, my website is [ Only registered users can see links on this board! Get registered or login! ] 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
 
hanscom







PostPosted: Tue Apr 10, 2007 3:44 am Reply with quote

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



Joined: Apr 30, 2004
Posts: 3221

PostPosted: Tue Apr 10, 2007 9:19 pm Reply with quote

If this is in the Nuke database, just use the Nuke database connections

Code:


$db->query

_________________
- Star Wars Rebellion Network -

Need help? Nuke Patched Core, Coding Services, Webmaster Services 
View user's profile Send private message Visit poster's website
hanscom







PostPosted: Wed Apr 11, 2007 2:33 am Reply with quote

Sorry, I don't understand.
Can you give an example to update a table?
TIA
 
evaders99







PostPosted: Wed Apr 11, 2007 4:38 pm Reply with quote

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

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 ©