Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
Hi guys :)
i design a template based on Google Material Design Lite, i use a pop-up share menu
it's require html id property so when i create a two posts when i press on share button in one of them the two appear because the two has the same id
in clean description if someway couch has a code can adding 1 every time for every post and store it
ex. i add a post with id 0 i want when i add the post 2 the id of this post change to 1 and post 3 id 2
if this now way in couch i use this code but it's not store the number i mean not dynamic
Code: Select all
<?php
$id = 0;
echo $id += 1 ;
$id = $id ;
?>

a very clean description is
when discovering database which CouchCMS installed i found a table called "somename_pages"
i want to retrieve the id of each post like this

Code: Select all
<a id="somecode" href="#">post 1 </a>
<a id="somecode" href="#">post 2 </a>


and output should be like this

Code: Select all
<a id="1" href="#">post 1 </a>
<a id="2" href="#">post 2 </a>


thanks in advance :D
I came I saw I Conquered :D
You can get a page's id through 'k_page_id' variable. Alternatively, you can also use 'k_page_name' as a unique identifier.
e.g.
Code: Select all
<cms:show k_page_id />
<cms:show k_page_name />

Hope it helps.
I would add that all ID's of pages throughout all templates are unique, so you can really have no worries about 2 posts in 'share' popup. So just use it as
Code: Select all
<a id="<cms:show k_page_id />" href="#">post</a>
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
3 posts Page 1 of 1