Could someone help me out with the code for this? (I know almost nothing about writing PHP.)
I would like to automatically include some pre-defined text from somewhere else every time a new post is created. The text would never be the same, however.
There may be a simplier way to do this, but one way I thought of doing it was the following:
Put the various pieces of different text in different files in a folder on my server. Name each of those files with number (e.g. 57.htm, 58.htm, 59.htm, etc.). And then with code, write an “include” php statement that would echo the post ID and insert that number into the include statement.
For example: <?php include ‘http://www.mainsite/static-content/[echo-post-ID-number].htm’); ?>
The result, it would seem to me, would be like this for Post #57:
<?php include ‘http://www.mainsite/static-content/57.htm’); ?>
In turn, this would then include the text that I have in my file 57.htm.
Is there a way to echo the post ID in this way into an include statement? Or is there an easier way to do the whole thing?
Thanks for any help.
- The topic ‘Including Other Files Based on Post ID’ is closed to new replies.