Site:Developer stuff/Changing next and previous links
From Feast upon the Word (http://feastupontheword.org). Copyright, Feast upon the Word.
Code isn't working yet, but I need to stop for now.
Note: this code is really ugly but it seemed easier to do this than working on something nicer.
Objective: Change "Next" and "Previous" links to show the user where they will be taken when they click them.
Building blocks
Name of previous page
SUBSTRING( cur_text , 21, instr( cur_text , '|Previous]]' ) - 21)
Name of next page
SUBSTRING( cur_text, char_length(cur_text)-65+instr( right(cur_text, 70), '|| [['), 56 - instr( right(cur_text, 70), '|| [['))
Middle content
SUBSTRING(cur_text , instr(cur_text , '|}' )+2 , char_length(cur_text )-153 +instr(right(cur_text , 150 ), '{| width="20%"
' )-instr(cur_text , '|}' ))
Test of middle content
select SUBSTRING(cur_text , instr(cur_text , '|}' )+2 , char_length(cur_text )-153 +instr(right(cur_text , 150 ), '{| width="20%"
' )-instr(cur_text , '|}' )), b.*
from test.commentary_pages_ordered a , thestandardworks.cur b
where a.cur_id=b.cur_id and right(SUBSTRING(cur_text , instr(cur_text , '|}' )+2 , char_length(cur_text )-153 +instr(right(cur_text , 150 ), '{| width="20%"' )-instr(cur_text , '|}' )), 4 )<>'----'