- This topic is empty.
January 31, 2014 at 11:14 pm #161575
Can someone help me figure out the logic to creating links to individual comments?
http://domain.com/articles/pairing-webtype/#comment-197January 31, 2014 at 11:17 pm #161576
Ooh, wait. Perhaps I can use the
idcolumn for this?January 31, 2014 at 11:25 pm #161577TheDocModerator
That should work! (not that I know what I’m doing)January 31, 2014 at 11:36 pm #161581
Haha. I agree, it should do the job.
@TheDoc Side note: You should watch these Harvard CS lectures I have. It’s what educated me on how to use
$_SESSIONand a few other things.February 1, 2014 at 1:02 am #161588
Can someone tell me how to stop the permalink from adding a slash to my url?
Keep clicking the hash symbol while watching the address bar.February 1, 2014 at 1:27 am #161589
How are you making the links? The slash is in your
href.February 1, 2014 at 1:34 am #161591
@traq Correct but how can I stop it from adding an additional forward slash?
Preferred when multiple clicks are triggered (stays the same):
#comment-111February 1, 2014 at 10:44 am #161601
Not sure you can (except via js, of course).
What I was getting at is that the link you posted above doesn’t have a slash before the hash. Do you want one (and only one)? or would you be happy with no slashes at all? In the latter case, you can simply leave the slash out of the href, and it will always look like
no matter how many times you click it.February 1, 2014 at 3:56 pm #161632
Do you want one (and only one)?
Yes, exactly.February 1, 2014 at 6:05 pm #161644
hmm… again, how are you creating these links? can you show me the code that writes them?February 1, 2014 at 6:09 pm #161645TheDocModerator
Would need to see how the links are being generated in the first place.February 1, 2014 at 9:19 pm #161652
The links are generated by appending the
idfrom the database.
Outputs domain and directory (domain.com/articles/article-title) $page = $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; Inside a foreach loop, this grabs the corresponding id from each particular row $permalink = $comment['id']; Generates a link (domain.com/articles/article-title/#comment-123) echo '<a href="'.$page.'/#comment-'.$permalink.'">#</a>'February 1, 2014 at 11:00 pm #161654
echo '<a href="'.rtrim( $page,'/' ).'/#comment-'.$permalink.'">#</a>'February 1, 2014 at 11:33 pm #161655
- The forum ‘Back End’ is closed to new topics and replies.