Jump to content

Adding Anchors


hjames82

Recommended Posts

I apologize but I am pretty new to PHP and have a question regarding using Anchors.

 

I have used them before but in simple Text Editors and HTML Pages but am not sure how to impliment it inside of a PHP File. Anyones help with this would be greatly appreciated.

 

Thanks in advance,

James

 

This is just an example of the anchor set I will be using:

 

Link To Anchor:     <a href="#top">top</a>
Anchor Position:     [#top]

 

I am assuming in the PHP I will put the [#top] and then where I want to put the reference I would put the link to it.

 

The big problem is how do I go about putting the link in this section of PHP:

 

global $mosConfig_absolute_path;	include_once($mosConfig_absolute_path."/mambots/conten/jom_comment_bot.php");
echo jomcomment ($link->link_id, "com_mtree");

 

I am pretty sure it would need to be insert somewhere in the second line after the echo for it to be displayed on the frontend of the page. But I am not sure.

 

Link to comment
https://forums.phpfreaks.com/topic/126336-adding-anchors/
Share on other sites

I tried putting it after echo jomcomment [#top] but it spit out an error on the page.

 

Should I surround it with something in particular to prevent any errors? If you need me to I can duplicate the error and get it for you.

 

Thanks,

James

 

Show me the error and what you actually put in there.

Link to comment
https://forums.phpfreaks.com/topic/126336-adding-anchors/#findComment-653354
Share on other sites

This is the code I input:

 

global $mosConfig_absolute_path;	include_once($mosConfig_absolute_path."/mambots/content/jom_comment_bot.php");
echo jomcomment [#top] ($link->link_id, "com_mtree");

 

This is the error I receive:

 

Parse error: syntax error, unexpected '[', expecting ',' or ';' in /home/.sylvie/hjames82/gamersspace.net/components/com_mtree/mtree.php on line 1450

 

Maybe if I give a better explanation of what I want to do it will help. Basically I am using Joomla and have a 3rd Party Component installed called MTree- This allows me to have a directory of listings. Well I have added another 3rd Party Integration of a commenting system. Which is the code above without the [#top] included. The page that the listing is viewed in does not actually have the code above in it but it calls to it for it to be displayed example here: http://gamersspace.net/index.php?option=com_mtree&task=viewlink&link_id=1&Itemid=36 at the very bottom of the page.

 

I want to create a graphic at the top of the page that says Comments and when clicked it would take the user to the bottom of the page at the comments section. I will attach the two files I am working with. 1. Is the Mtree.php file or the core file of the whole component and 2. Is sub_ListingDetails.php the template file or display file for what you see on the webpage.

 

The code referenced above is at line 1450 in Mtree.php << When I add this code it adds the ability to comment EVERY listing in MTree which is fine. Just need to add that Anchor to it somehow and then on the template file add the anchor call out. If you can show me somehow it will teach me and I can make notes and will learn from you.

 

Thanks again for helping me out and taking the time,

James

 

 

Can you tell me how to use an image as an anchor rather then txt? << Since this is what it will actually be.

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/126336-adding-anchors/#findComment-653369
Share on other sites

It makes no sense there.  jomcomment() is a function, so why would you put it in between the function name and its arguments?  Anyway...you don't assign an HTML anchor with [#something].  You either use <a name=""> or just give the element an ID an the browser should know what to do with it.  You may just need to play with the internal formatting of jomcomment().

Link to comment
https://forums.phpfreaks.com/topic/126336-adding-anchors/#findComment-653371
Share on other sites

Well JomComment wasn't designed to be used with MTree so you have to use the HACK as they call it which is that code I showed you. Did you happen to look at that webpage?

 

Can you give me the correct way to Use an Anchor? I am thinking I am off a little bit.

 

Thanks,

James

Link to comment
https://forums.phpfreaks.com/topic/126336-adding-anchors/#findComment-653379
Share on other sites

Well JomComment wasn't designed to be used with MTree so you have to use the HACK as they call it which is that code I showed you. Did you happen to look at that webpage?

 

Can you give me the correct way to Use an Anchor? I am thinking I am off a little bit.

 

Thanks,

James

 

Sorry, just noticed the link.  You'd need to put the anchor wayyy before that comment code, up in the header practically.  Just like:

<div id='top'></div>

 

And then add a link down at the bottom.

Link to comment
https://forums.phpfreaks.com/topic/126336-adding-anchors/#findComment-653387
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.