×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Direct URL!

Direct URL! 14 years 6 months ago #7123

  • was
  • was's Avatar Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 44
  • Thank you received: 0
How to have a direct url to a specific comment?

Direct URL! 14 years 6 months ago #7124

  • JonusC
  • JonusC's Avatar
  • Offline
  • Platinum Boarder
  • Platinum Boarder
  • Posts: 785
  • Thank you received: 48
PermaLinking is not implemented yet, it's impossible. But it's planned for a future release.

However you can manually add an anchor parameter to your URL, in the format #josc90 to jump to Comment ID 90 for example.

Tip: To find the CommentID of a specific comment easily, hover the mouse over the reply button and look at the status bar - you will see javascript:JOSC_reply(90) if the ID is 90, thus the anchor for that comment is #josc90.

Direct URL! 14 years 6 months ago #7125

  • was
  • was's Avatar Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 44
  • Thank you received: 0
I know very well that but for a newbie it needs a one year to get there :)

Yet it is very easy to add an anchor!
Add the id of comment in the title with a simple link!

<a name="#josc<?php echo $id_comment;?>">#<?php echo $id_comment;?></a>

Direct URL! 14 years 6 months ago #7126

  • JonusC
  • JonusC's Avatar
  • Offline
  • Platinum Boarder
  • Platinum Boarder
  • Posts: 785
  • Thank you received: 48
If that's all you want, then can you not do it yourself already? I think it may be easier for you to do it with JavaScript too ;)

EDIT: You don't even need JavaScript or PHP for that. Just modify the template index.html with this line:
<span class='posttitle'><a href='#josc{id}'>{title}</a></span>
...just search for 'posttitle' in the index.html file and make the adjustments there :)

EDIT2: The reason why we havn't added the ID to every comment yet is because they don't make sense, relative to time, and should only be viewed internally and not by the public. A future version will have real numbering on the comments, that is - the first comment will have #1, the second will have #2, and so on. Those will be linkable, and the backend will have an option to make these links a stand-alone "Single Post" view. I.e. a popup or a link for embedding/quoting on another site.

Direct URL! 14 years 6 months ago #7127

  • was
  • was's Avatar Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 44
  • Thank you received: 0
It works not! it doesn't take into template changes!

My Template is 'modern'

Direct URL! 14 years 6 months ago #7128

  • JonusC
  • JonusC's Avatar
  • Offline
  • Platinum Boarder
  • Platinum Boarder
  • Posts: 785
  • Thank you received: 48
<span class='posttitle'><a href='#josc{id}'>{title}</a></span>
That works 100%. Do you mean PHP? All PHP is ignored in the template. That's why I said JavaScript. But that code above does work, I just tried it.

If you want the title to not be hyperlinked, but to put the CommentID inside the title and make THAT linked, then do this instead:
<span class='posttitle'><a href='#josc{id}'>#{id}</a> - {title}</span>

Direct URL! 14 years 6 months ago #7129

  • was
  • was's Avatar Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 44
  • Thank you received: 0
it works not!
Even when I empty the following index.html file: /www/components/com_comment/joscomment/templates/modern/index.html display remains without change!

I tried this change with other templates but nothing changes!

Jooomlcomment uses an internal cache?

Direct URL! 14 years 6 months ago #7130

  • was
  • was's Avatar Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 44
  • Thank you received: 0
There was something weird!
I renamed all the folders templates but my site continue to run!

Direct URL! 14 years 6 months ago #7131

  • JonusC
  • JonusC's Avatar
  • Offline
  • Platinum Boarder
  • Platinum Boarder
  • Posts: 785
  • Thank you received: 48
No, JoomlaComment has no cache. But i promise, it does work for me :) There must be something else. Clear the Joomla system cache, the sh404SEF cache (if you use sh404SEF) AND your browser cache. And make sure you actually have the modern template selected, and not a customized one! Otherwise you need to browse through the media folder to edit the custom template.

Make sure you have no errors in the HTML either! Install WebDeveloper Toolbar for Firefox to check that ;)

There was something weird!
I renamed all the folders templates but my site continue to run!

Are you sure you are on the right folder or FTP server? :P I've made that mistake myself before.

Direct URL! 14 years 6 months ago #7180

  • was
  • was's Avatar Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 44
  • Thank you received: 0
I'am sorry! my host changed the server and I use my old server!

But in fact your method it not works!

it generates a link:

www.mywebsite.com/#3323

Direct URL! 14 years 6 months ago #7183

  • JonusC
  • JonusC's Avatar
  • Offline
  • Platinum Boarder
  • Platinum Boarder
  • Posts: 785
  • Thank you received: 48
I thought that's what you wanted. To put a number infront of each Comment Post on the Content Item and make it hyperlinked to it's anchor position, so a user can right-click > Copy Address for that comment? Take a look on the right of my post, above my Display Picture and Name - see the #7183? That's what I thought you wanted - permalinking. But I guess not...

So now i'm lost :S can you explain what exactly you are trying to do?

Direct URL! 14 years 6 months ago #7196

  • was
  • was's Avatar Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 44
  • Thank you received: 0
Yes! That's why I want to do! but he generates the anchor relative to site root and not relative to the article!

False:
www.mysite.com/#josc3323

True:
www.mysite.com/index.php?option=com_cont...ent_id=3789#josc3323

:)

Direct URL! 14 years 6 months ago #7208

  • JonusC
  • JonusC's Avatar
  • Offline
  • Platinum Boarder
  • Platinum Boarder
  • Posts: 785
  • Thank you received: 48
was wrote:

Yes! That's why I want to do! but he generates the anchor relative to site root and not relative to the article!


I don't know what to say. No, it doesn't, you are not doing it right. Many times I've created an < a href="#anchor" > Go To Anchor < /a > similar code, and in every browser it will jump to the specified #anchor on the current page, not the site root. You'd need to put a forwardslash / in there to make it chance the HTML page location to load.

This is very basic HTML stuff, the sort of thing you learn on second day of high school web design. It's all on the HTML Links Tutorial @ W3Schools.com

Direct URL! 14 years 6 months ago #7221

  • was
  • was's Avatar Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 44
  • Thank you received: 0
Unfortunately this is the case with !JoomlaComment!

Maybe because I use a htaccess file for rewriting urls??

Otherwise I can't get somewhere in the absolue url of the article via the variable engine templates?

Direct URL! 14 years 5 months ago #7633

  • JonusC
  • JonusC's Avatar
  • Offline
  • Platinum Boarder
  • Platinum Boarder
  • Posts: 785
  • Thank you received: 48
Hey was, sorry about the late reply I completely forgot about this and have had ISP troubles at home :(

Well the htaccess rewrite might conflict. I also thought you would be using an SEF generator... I don't know how to do it with the raw root php uri :S

Direct URL! 14 years 4 weeks ago #9314

  • was
  • was's Avatar Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 44
  • Thank you received: 0
Solution when you use SEF generator :

template : <a href="{anchorlink}">{username}</a>

in file comment.class.php file add this function before function post_htmlcode() line 2175
function curPageURL() {
	 $pageURL = 'http';
	 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
	 $pageURL .= "://";
	 if ($_SERVER["SERVER_PORT"] != "80") {
	  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
	 } else {
	  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
	 }
	 return $pageURL;
	}
source : www.webcheatsheet.com/PHP/get_current_page_url.php

Replace
	/* {username} 	*/
	$html 		= str_replace('{username}', $this->profileLink($name, $this->_user_id), $html);
By
	/* {username} 	*/
	$html 		= str_replace('{username}', $this->profileLink($name, $this->_user_id), $html);
	/* {anchorlink}	*/
	$html 		= str_replace('{anchorlink}',$this->curPageURL()."#josc".$id, $html);

:)
  • Page:
  • 1
Time to create page: 0.139 seconds