Loading...
 
Skip to main content

Development


Re: Several headings in different posts at the same thread

posts: 3 Ukraine

The problem is that each message parsed separately by code:

tikilib.php
Copy to clipboard
function parse_data_process_maketoc ... if ($divstate == '+' || $divstate == '-') { // OK. Must insert flipper after HEADER, and then open new div... $thisid = 'id' . ereg_replace('[^a-zA-z0-9]', '',urlencode($options['page'])) .$nb_hdrs;

1. Solution number one:

Generate unique id for every heading:

tikilib.php
Copy to clipboard
function parse_data_process_maketoc ... if ($divstate == '+' || $divstate == '-') { // OK. Must insert flipper after HEADER, and then open new div... $thisid = 'id' . microtime() * 1000000;

For the anchor to allow bookmarks or links we can add another hidden control with old-style id:

tikilib.php
Copy to clipboard
$thisid = "id" . ereg_replace('[^a-zA-z0-9]', '',urlencode($options['page'])) .$nb_hdrs; $aclose2 .= '< div id="' . $thisid . '">';


2. Solution number two:

Use specifics section. For example:

tikilib.php
Copy to clipboard
function parse_data_process_maketoc ... global $section, $comment_info; switch ($section) { case "forums": $id_prefix = str_replace('@','',$comment_info['message_id']); break; }; if (!isset($id_prefix)) $id_prefix = "id"; // OK. Must insert flipper after HEADER, and then open new div... $thisid = $id_prefix . ereg_replace('[^a-zA-z0-9]', '',urlencode($options['page'])) .$nb_hdrs;

3. Solution number three:


Add to Tiki global identifier of any object. For example through the global counter or something like that.

4. Any other solutions???

There are no comments at this time.