Code: Select all
preg_match_all('#<!-- INCLUDE (\{\$?[A-Z0-9\-_]+\}|[a-zA-Z0-9\_\-\+\./]+) -->#', $code, $matches);
{EXTRATEXT}
.<!-- INCLUDE ... -->
code in the viewtopic_body.html template<!-- INCLUDE /path/to/
and -->
around {EXTRATEXT}
- so do I load 'EXTRATEXT' like this Code: Select all
'EXTRATEXT' => preg_match_all('#<!-- INCLUDE (\{\$?[A-Z0-9\-_]+\}|[a-zA-Z0-9\_\-\+\./]+) -->#', $code, $matches);
$code
and $matches
Code: Select all
preg_match_all('#<!-- INCLUDE (\{\$?[A-Z0-9\-_]+\}|[a-zA-Z0-9\_\-\+\./]+) -->#', '<!-- INCLUDE path/to/' . $topic_data['extra_text'] . '.html -->', $extratextcode, $matches);
'EXTRA_TEXT_INCLUDE' => $extratextcode,
{EXTRA_TEXT_INCLUDE}
but the output is the word "Array" instead of the contents of the filename'EXTRA_TEXT_INCLUDE' => $extratextcode[0],
or 'EXTRA_TEXT_INCLUDE' => $extratextcode[1],
but the output is still the same, the word "Array"No, it's the part that renders the template INCLUDE instruction, hence I didn't add any file and position where to add this. From the code you can see that INCLUDE either accepts variables (gussie wrote:Should I add the code that you suggest in the viewtopic.php file?
{VARIABLE}
) or filenames (/to/file.html
), but no mixture. If you want to mix it, then do it where you assign VARIABLE
already.Thank you for checking back in here, AmigoJack!AmigoJack wrote:No, it's the part that renders the template INCLUDE instruction, hence I didn't add any file and position where to add this. From the code you can see that INCLUDE either accepts variables (gussie wrote:Should I add the code that you suggest in the viewtopic.php file?{VARIABLE}
) or filenames (/to/file.html
), but no mixture. If you want to mix it, then do it where you assignVARIABLE
already.
Code: Select all
<!-- INCLUDE /to/file.html -->
Code: Select all
preg_match_all('#<!-- INCLUDE (\{\$?[A-Z0-9\-_]+\}|[a-zA-Z0-9\_\-\+\./]+) -->#', $code, $matches);
/to/file.html
- should I put it in place of #code or #matches? Or is it supposed to go between the # signs?Code: Select all
<!-- INCLUDE file.html -->
Code: Select all
<!-- INCLUDE {MY_FILE} -->
Code: Select all
<!-- INCLUDE overall_header.html -->
Yes! That's my understanding as well. This is why AmigoJack's original line of code didn't make sense to me. I assumed it would go into the php fileLumpy Burgertushie wrote:no, you don't put php in the html file.
the point is that the php file is where you have to create whatever variable you are wanting to use.
I have no idea what you are trying to accomplish but it doesn't matter.
you create the variable with php , you put that new php code in the relevant php file.
once the variable is created, you can then use that variable in a html file.
Yeah, and that is NOT what I am trying to do. That much I do know.Lumpy Burgertushie wrote:if you have a html file that you wish to include in another html file then just do the same thing.
Right - that much I already know.AmigoJack wrote:Open /styles/*/template/*.html and add eitherorCode: Select all
<!-- INCLUDE file.html -->
You have to decide upon one of both forms, you can't combine them.Code: Select all
<!-- INCLUDE {MY_FILE} -->
Because it would have to be in a post, and that post would not appear conveniently at the bottom (or wherever) of every page of the topic thread.Lumpy Burgertushie wrote:why not create one or more custom bbcodes and not show them on the posting page. your mods/admins would know what they are and could post whatever this extra text is at will in any post on the board.
That would begussie wrote:If {JUST_DO_IT}, then <!--INCLUDE {JUST_DO_IT}.txt -->
Code: Select all
<!-- IF {JUST_DO_IT} --><!-- INCLUDE {JUST_DO_IT} --><!-- ENDIF -->
That's what post edit reasons are for.gussie wrote:some official warning or explanation
Since it was PHP code it was meant to be in a PHP file, of course. But not to be inserted or used by you. And sincegussie wrote:Since it wasn't clear to me whether to use AmigoJack's line in a template, I assumed he or she must have meant to use it in the php file - because preg_match_all is a function call
{JUST_DO_IT}
does not appear by will I assumed you already know where to define this - was I wrong?Thank you! I'll give that a shotAmigoJack wrote:That would begussie wrote:If {JUST_DO_IT}, then <!--INCLUDE {JUST_DO_IT}.txt -->Code: Select all
<!-- IF {JUST_DO_IT} --><!-- INCLUDE {JUST_DO_IT} --><!-- ENDIF -->
Right, but we have encountered situations where we might want to place special messages on every page of the topic for special situations. To wit, earlier this month, in a thread about a religious group, links were being posted to external websites (not ours) that warned people about a particular group. That group actually contacted us and hinted legal action - not about stuff on our forums, but on stuff on those blogs. We are based in a country where a libel suit, no matter how ultimately spurious, can be easily and inexpensively initiated. Posting a simple reminder (stating the obvious notion that stuff that is not on our website is, well, not our responsibility - heck, we even disclaim stuff on our own website!) mollified the religious group in question. We would not necessarily want that reminder on every page of the site, but posting it on every page of a long discussion is a nice touch.AmigoJack wrote:That's what post edit reasons are for.gussie wrote:some official warning or explanation
I guess you were mistaken to assume a deeper understanding of modifying the PHP files on my part, and I'm sorry for that. I'm still a bit hazy on what you mean by the preg_match_all function "not to be inserted or used by you", because I think we agree that I was expected to insert or use it in the PHP file somewhere. I ended up trying to insert it just before the variables are set up in the PHP file, but I didn't know how to relateAmigoJack wrote:Since it was PHP code it was meant to be in a PHP file, of course. But not to be inserted or used by you. And sincegussie wrote:Since it wasn't clear to me whether to use AmigoJack's line in a template, I assumed he or she must have meant to use it in the php file - because preg_match_all is a function call{JUST_DO_IT}
does not appear by will I assumed you already know where to define this - was I wrong?
{JUST_DO_IT}
to that code snippet.{JUST_DO_IT}
instead of simply the word "embededcontent" -- THANK YOU! That worked!!!AmigoJack wrote:That would begussie wrote:If {JUST_DO_IT}, then <!--INCLUDE {JUST_DO_IT}.txt -->Code: Select all
<!-- IF {JUST_DO_IT} --><!-- INCLUDE {JUST_DO_IT} --><!-- ENDIF -->