Jump to content

PHP function links


Recommended Posts

It would sure save a lot of typing if the forum could automatically recognize PHP function names in PHP code blocks replace them with links to http://php.net/function_name

 

It wouldn't be that hard to detect PHP functions names 'get_defined_functions()'. http://us2.php.net/manual/en/function.get-defined-functions.php

 

This feature would allow the people unfamiliar with PHP and the PHP manual to learn more about each function just by clicking on it.

Link to comment
Share on other sites

I'm pretty sure they will say:

 

That would mean modifying the core SMF code.  Sorry, but no.

 

You could always suggest it to the SMF team. Perhaps they like the idea and will implement it in future releases.

 

Talk to SMF if you want upgrades to it.

 

But who knows, maybe they will implement it.

Link to comment
Share on other sites

Coreye, you're starting to get the hang of it. :P

 

I think we had something like this, except it was far from automatic... SMF lets you define custom BBcode tags, and we had one something like [man][/man], that would link to the PHP manual page for the function inside the [man] tag. I can't seem to find it - admins, can you clarify A) if such a thing exists, and (if A) B) what the tag is?

Link to comment
Share on other sites

Yeah, they probably will say that.  :(

 

But it really wouldn't be that hard. Sombody might even be able to do it with on line of code using regular expressions. Also the current SMF code already detects and specially processes PHP code so there would be no problem with that either.

 

This would be complety automated, so nobody would have to bother typing ( or clicking for those that havn't learned how to use the keyboard yet.  :o ) the [man] tag.

 

Link to comment
Share on other sites

I'm pretty sure they will say:

 

That would mean modifying the core SMF code.  Sorry, but no.

 

You could always suggest it to the SMF team. Perhaps they like the idea and will implement it in future releases.

 

Talk to SMF if you want upgrades to it.

 

But who knows, maybe they will implement it.

 

imho, it is a really bad practice to make edits to an application's core like that unless it is absolutely necessary for it to function properly. The main reason is that it will make future updates a real pita. We would have to keep a copy of the release that we are currently using and diff the production copy against the original. Then we would have to compare that with any new releases. So, we have opted to forgo this by keeping the edits limited as much as possible. I generally group features by Must Have, Should Have, Could Have and Wont Have. As far as the forums are concerned if it doesn't fit into the first group it is most likely not going to happen. It would be completely different if we were the developers behind smf.

Link to comment
Share on other sites

I think we had something like this, except it was far from automatic... SMF lets you define custom BBcode tags, and we had one something like [man][/man], that would link to the PHP manual page for the function inside the [man] tag. I can't seem to find it - admins, can you clarify A) if such a thing exists, and (if A) B) what the tag is?

 

You can select which of the built-in bbcodes that should be enabled here, but you cannot add additional codes. You don't seem to be able to do it in SMF 2 either, but if they implement it in the final release (unlikely), then I wouldn't mind adding a such code. It will in no way be automatic though as we risk regular text will trigger it and add totally irrelevant links.

Link to comment
Share on other sites

It will in no way be automatic though as we risk regular text will trigger it and add totally irrelevant links.

 

I was only reccomending this for PHP code blocks ( which are already detected becuase of the special syntax highlighting they get ). That would limit it to PHP code only. Would it really be that bad if somebody had a function name in there comments or strings and it got detected and linked? If it is, then it would not be very hard to detect comments and strings and skip them. That is very easy to do.

Link to comment
Share on other sites

If only code blocks would respect php highlighting too...

They do if the user uses lowercase <?php tags.

 

or, equivalently, if php blocks were scrollable.

Maybe it can be done using CSS. I'll try to see that. I don't mind doing changes to the stylesheet.

 

echo "testing... just to have some html source code to look at...";

 

Edit:

 blocks now have the same CSS as [code] blocks have.

 

It will in no way be automatic though as we risk regular text will trigger it and add totally irrelevant links.

 

I was only reccomending this for PHP code blocks ( which are already detected becuase of the special syntax highlighting they get ). That would limit it to PHP code only. Would it really be that bad if somebody had a function name in there comments or strings and it got detected and linked? If it is, then it would not be very hard to detect comments and strings and skip them. That is very easy to do.

Perhaps, but we are still not going to modify the SMF core files. See Tom's post for the reason.

Link to comment
Share on other sites

Coreye, you're starting to get the hang of it. :P

 

I think we had something like this, except it was far from automatic... SMF lets you define custom BBcode tags, and we had one something like [man][/man], that would link to the PHP manual page for the function inside the [man] tag. I can't seem to find it - admins, can you clarify A) if such a thing exists, and (if A) B) what the tag is?

 

We've never had this feature on this board, I did suggest it a long while back but yeah... no go. I used it on another board I once frequented.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.