Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: PHP include not picking up in template.html  (Read 3817 times)

0 Members and 1 Guest are viewing this topic.

Hanna.

  • Coppermine frequent poster
  • ***
  • Country: us
  • Offline Offline
  • Gender: Female
  • Posts: 180
  • webstar
PHP include not picking up in template.html
« on: June 20, 2019, 05:56:13 pm »

Hey guys - I am trying to make things easier for myself (with many coppermine installations) to now start using PHP include so I can finally have "flat" template.html's and edit the php files for manual corrections.

However, the general code for PHP include that I am trying to set up is:
Code: [Select]
<?php include("disclaimer.php"); ?>
The file is online and ready to be picked up (see link)

The template.html and disclaimer.php are located in the theme folder together.

disclaimer.php inside looks like this: (if relevant to fix this issue)

Code: [Select]
<!DOCTYPE html>
<html>
<body>

<h1>My first PHP page</h1>

<?php
echo "Hello World!";
?>


</body>
</html>

If I am missing something please tell me.
Logged

ron4mac

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Posts: 1344
Re: PHP include not picking up in template.html
« Reply #1 on: June 20, 2019, 06:46:58 pm »

You can not include a PHP file in a .html file.

Describe fully what you are trying to achieve.
Logged

Hanna.

  • Coppermine frequent poster
  • ***
  • Country: us
  • Offline Offline
  • Gender: Female
  • Posts: 180
  • webstar
Re: PHP include not picking up in template.html
« Reply #2 on: June 20, 2019, 06:50:58 pm »

I'm trying to include different sections into template.html from other files (with content). You are saying I cannot do that?
Logged

ron4mac

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Posts: 1344
Re: PHP include not picking up in template.html
« Reply #3 on: June 21, 2019, 02:15:28 pm »

HTML can be imbedded in a PHP file, but PHP can not be imbedded in a HTML file.

You could use this (somewhat kludgy) method to include HTML files in your template.html.
https://www.w3schools.com/howto/howto_html_include.asp
Logged

Phill Luckhurst

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4683
    • Windsurf.me
Re: PHP include not picking up in template.html
« Reply #4 on: June 21, 2019, 11:46:03 pm »

I'm trying to include different sections into template.html from other files (with content). You are saying I cannot do that?

Maybe explain in more detail what you are trying to accomplish. HTML is client side, PHP is server side executed. The two can interact. PHP can generate HTML, HTML can send information to PHP. So what output from a PHP file do you want in your HTML?
Logged
It is a mistake to think you can solve any major problems just with potatoes.

Hanna.

  • Coppermine frequent poster
  • ***
  • Country: us
  • Offline Offline
  • Gender: Female
  • Posts: 180
  • webstar
Re: PHP include not picking up in template.html
« Reply #5 on: June 25, 2019, 12:54:58 am »

Maybe explain in more detail what you are trying to accomplish. HTML is client side, PHP is server side executed. The two can interact. PHP can generate HTML, HTML can send information to PHP. So what output from a PHP file do you want in your HTML?

I am trying to use template.html as it comes, with the basics {} codes etc. And keep it as a clean template.

Then I am trying to IMPORT content from other html or php (such as specific texts/images and what not) to display on the template.html as sections. Just as you would import header.php and footer.php to an index.php BUT do it with template.html.
Logged

ron4mac

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Posts: 1344
Re: PHP include not picking up in template.html
« Reply #6 on: June 25, 2019, 04:25:26 pm »

Here is a plugin I put together for you to try. See the README for use instructions.
Only works with inserting HTML. I may later expand it to be able to include PHP ... don't know yet.
Logged

Hanna.

  • Coppermine frequent poster
  • ***
  • Country: us
  • Offline Offline
  • Gender: Female
  • Posts: 180
  • webstar
Re: PHP include not picking up in template.html
« Reply #7 on: June 27, 2019, 01:27:13 pm »

Here is a plugin I put together for you to try. See the README for use instructions.
Only works with inserting HTML. I may later expand it to be able to include PHP ... don't know yet.

This is precisely what I needed! HTML is perfect! Thank you!!!
Logged
Pages: [1]   Go Up
 

Page created in 0.045 seconds with 20 queries.