- This topic is empty.
-
AuthorPosts
-
January 31, 2014 at 11:14 pm #161575chrisburtonParticipant
Can someone help me figure out the logic to creating links to individual comments?
Examples:
http://domain.com/articles/made-with-kirby/#comment-1
OR
http://domain.com/articles/pairing-webtype/#comment-197
January 31, 2014 at 11:17 pm #161576chrisburtonParticipantOoh, wait. Perhaps I can use the
id
column for this?January 31, 2014 at 11:25 pm #161577TheDocMemberThat should work! (not that I know what I’m doing)
January 31, 2014 at 11:36 pm #161581chrisburtonParticipantHaha. 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
$_SESSION
and a few other things.February 1, 2014 at 1:02 am #161588chrisburtonParticipantCan someone tell me how to stop the permalink from adding a slash to my url?
http://chrisburton.me/dev/articles/made-with-kirby#comment-111
Keep clicking the hash symbol while watching the address bar.
February 1, 2014 at 1:27 am #161589__ParticipantHow are you making the links? The slash is in your
href
.February 1, 2014 at 1:34 am #161591chrisburtonParticipant@traq Correct but how can I stop it from adding an additional forward slash?
Preferred when multiple clicks are triggered (stays the same):
/made-with-kirby
/
#comment-111
Reality:
/made-with-kirby
//
#comment-111
February 1, 2014 at 10:44 am #161601__ParticipantNot 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
/made-with-kirby#comment-111
no matter how many times you click it.
February 1, 2014 at 3:56 pm #161632chrisburtonParticipantDo you want one (and only one)?
Yes, exactly.
February 1, 2014 at 6:05 pm #161644__Participanthmm… again, how are you creating these links? can you show me the code that writes them?
February 1, 2014 at 6:09 pm #161645TheDocMemberWould need to see how the links are being generated in the first place.
February 1, 2014 at 9:19 pm #161652chrisburtonParticipantThe links are generated by appending the
id
from 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__Participantecho '<a href="'.rtrim( $page,'/' ).'/#comment-'.$permalink.'">#</a>'
February 1, 2014 at 11:33 pm #161655chrisburtonParticipantAs simple as rtrim(). Thank you @traq!
-
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.