Ryan_B Posted May 21, 2015 Share Posted May 21, 2015 I'm a newbie to FusionPro, so don't criticize me too much. I'm working on a book project that allows the user to select/omit certain pages and/or sections of the book. This book has a table of contents that needs to dynamically change based on the selections from the user. I have the sections (chapters) getting displayed properly based on their selection, however I can't figure out how to display the page number that that section starts on. Every page has a text frame with the <<$pagenum>> variable inserted that changes based on the users selections. How can I check what the page number is, then input that into my text frame on my table of contents? Quote Link to comment Share on other sites More sharing options...
David Miller Posted May 21, 2015 Share Posted May 21, 2015 Take a look at this post here. Quote Link to comment Share on other sites More sharing options...
Ryan_B Posted May 21, 2015 Author Share Posted May 21, 2015 I'm sorry, but I don't really understand that post. I don't have any fields involved, just text frames. Quote Link to comment Share on other sites More sharing options...
David Miller Posted May 21, 2015 Share Posted May 21, 2015 (edited) I'm sorry, but I don't really understand that post. I don't have any fields involved, just text frames. No need to apologize. That post was more specific to an index. But, as Dan pointed out, it can be applied to a TOC. Yes, you can use the <destination> tag to mark some text, and then use the <crossref> tag to create a reference to it in an index or table of contents. (You can also use a <hypertext> tag to create a hyperlink if you're composing to a PDF.) You don't need to name <destination> with a template field. You can just give it a name. You might try replacing your section page numbers with a rule like this: return '<destination name="Section 1">Page <$pagenum>'; Then, in your Table of Contents (TOC) refer to the section page number with something like this: return '<crossref name="Section 1">Page <$pagenum></crossref>'; The name of the <destination> and <crossref> tags must match. As Dan pointed out: Please refer to the Tags Reference Guide for more information. Search for "Cross Reference Tag". Correction and feedback welcomed if I missed anything. Have an upcoming project requiring something similar. Edited May 22, 2015 by David Miller Quote Link to comment Share on other sites More sharing options...
Ryan_B Posted May 22, 2015 Author Share Posted May 22, 2015 Thanks David for helping me out here, but I must still be missing something. Let me lay it all out for you: I've created two new rules. The first one I called pgNumber and put in this code: return '<destination name="Section 1">Page <$pagenum>'; Then, on each page where I want a page number, inside my text frames, I inserted that rule. My second rule I called toc and put in this code: return '<crossref name="Section 1">Page <$pagenum></crossref>'; Then on my table of contents page within each text frame where I want the corresponding page number to show up, I dropped in that rule. Here's my problem. Nothing is showing up. Neither the page number on the pages, or the page number within the table of contents. What am I missing? Quote Link to comment Share on other sites More sharing options...
David Miller Posted May 22, 2015 Share Posted May 22, 2015 (edited) Thanks David for helping me out here, but I must still be missing something. Let me lay it all out for you: I've created two new rules. The first one I called pgNumber and put in this code: return '<destination name="Section 1">Page <$pagenum>'; Then, on each page where I want a page number, inside my text frames, I inserted that rule. You're applying the rule to each page (that has a page number) with the same destination name? Essentially, tagging each page in your document as "Section 1"? First, you should only apply the rule to the first page of each section that might be listed in your TOC. Second, each section should have a unique destination name. So, you'll need a separate rule for each section with a unique destination name. return '<destination name="[color="Red"]Section 1[/color]">Page <$pagenum>'; The destination name, in red, should be unique to each section. Admittedly, I'm not sure if the <destination> tag should be applied to the variable <$pagenum> tag. It might be better to apply it to some other text on the first page of a section. For example, the section title or some invisible text near the page number. I'd welcome some input from other forum members. Otherwise, a little experimenting wouldn't hurt either of us, eh? My second rule I called toc and put in this code: return '<crossref name="Section 1">Page <$pagenum></crossref>'; Then on my table of contents page within each text frame where I want the corresponding page number to show up, I dropped in that rule. You're returning the page number of every page (with a page number) on each line in your TOC? Essentially, returning the page number of all template pages on every line in your TOC? You should have a corresponding crossref rule for each section. The crossref name should match the destination name and be placed on the corresponding TOC line. return '<crossref name="[color="Red"]Section 1[/color]">Page <$pagenum></crossref>'; So, the crossref name in red, should match the corresponding destination name. Again, please refer to the Tags Reference Guide. Search for "Cross Reference Tag". Please read... In the Cross Reference Tag, the attribute "name" is required. You must use the destination tag, also, and they must have matching values. Here's my problem. Nothing is showing up. Neither the page number on the pages, or the page number within the table of contents. What am I missing? Aside from what's mentioned above, I'm not sure if there are other problems in your template. If this doesn't help, I suggest you collect and post your template files. Edited May 23, 2015 by David Miller Quote Link to comment Share on other sites More sharing options...
Ryan_B Posted May 27, 2015 Author Share Posted May 27, 2015 Thanks David for your response. I was finally able to get it to work, but I had to create an overflow page to do so. Then on the text frame with the <destination> tag, I had to set its overflow properties to the overflow page. This is the only way I was able to get it to work. I didn't try adding the <destination> tag to the <$pagenum> tag though. I just created another text frame on the page I was referencing. Thanks for your help on the matter. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.