SMF displays raw HTML and PHP on browser - php

I am new to SMF.
I just installed SMF on my website. I tried editing the index.template.php . After saving changes, it displays raw HTML and PHP on the browser. I tried fixing the prob by returning the the page back to the original state to no avail.
At the moment, everything is gibberish both frontend and backend.
Pls what do i do?

There should be at least an open tag at the top of the file (at the top of every .php file). Make sure you didn't remove this tag. Everything outside of a <?php is interpreted as normal text so if you have removed this it would explain your issue.

Also, being an ex-team member for SMF I can assure you its better to create a copy of the default theme, then make your edits to that theme. Then if you experience an error you can always pass a param in the url to reset to the default theme (in case you need to get into the admin area). To do so end the url with index.php?theme=1

Related

Some elements missing / changed when trying to change from html to php

I'm asking for help for those who have experience in changing an html file to a php file. I've tried everything I know (and I'm not the smartest I admit) but I don't understand why the following is happening.
Currently: When viewing on mobile, the mobile menu button has gone, the toggle switch which changed prices from monthly to annually, tabs which displayed different content has gone. As a result:
If there was a toggle, both the toggle results are displayed one above the other
If there was a tab, each tab element is displayed underneath the other
The mobile menu button has gone completely
Background:
I purchased an HTML template but it turns out the seller didn't want to help. I wanted to split and convert the page into a php page as I wanted a single header/footer file which I could import. As you will see (if you check the repo) the header.php and footer.php file is getting imported into the page php file.
I created the pages by first:
Renaming the original html file to a php file
Cut the header and footer and import them back into the page php file
That's all I have done. It seemed to work, however another check (after cache cleared) I noticed the issues.
The link to the site page im referring to is:
https://blueboxhosting.co.uk/products-cloud-hosting
But if you look at any of the pages, you'll see errors on all of them now where they're should have been controls (eg toggles, mobile menu, tabs etc)
I've created a snipped so you can view the code and HOPEFULLY spot where I've been a moron:
https://bitbucket.org/snippets/bbhostinguk/7e5qxp
Any help with this would be amazing as I just can't figure it out.
Start by running the HTML generated by PHP through a validator, e.g. https://validator.w3.org/
Your code has numerous stray tags which may or may not affect the rendering.
Another tip is to comment off everything and then uncomment section by section and check when things start to break.

PHP not rendering out on specific page

You can see on this page: http://oaktreehealth.ca/community/
That the PHP is not rendering out for some reason. I have the same function enabled on most other pages where you see the image in the background at the top of the page.
I'm not sure why all of a sudden it stopped rendering on this page? It was working fine, maybe a wordpress update?. I'm using wooththemes Canvas with a child theme. The only difference with this page is that it is a modified template of the blog template.
The area causing trouble is called in my functions to grab the template part. All other pages do this fine except this one. Any idea?
I'm not entirely sure how to add code in here, but i'm happy to send anything along to help.
The page you've linked, seems to have encoding issues, i believe due to white spaces before the php tag, if you inspect the source, you can see:
��<?php
Check the script corresponding to the following comment (as per the source):
/**
* Template part for Media Feature Area
*/
And try to remove all whitespaces at the beginning and end of the script.

Joomla add/edit article and section screens blank

I'm using Joomla v1.5.26 and for whatever reason when I navigate to MYSITE.com/administrator/index.php?option=com_content&task=add or if I try to edit any already existing articles (or sections) I get a screen with an empty body tag.
The other pages in the administrator part seem to be working.
It seems to be the same (or very similar) problem as this: http://www.justanswer.com/computer-programming/32fo1-when-hit-new-button-article-manager-joomla.html but this is the only instance I could find of the problem, and it isn't resolved at the end of the article.
Thank you for your help.
My suggestion:
1- Try to disable the editor you are using (Set it to no editor on global settings or on the user you are trying to edit with)
2- Try to reupload components/com_content from Joomla 1.5.26 source to your website and overwrite the existing file. There might be something missing.

Drupal PHP Content Warns of Virus

I have a Drupal site with a page that contains a PHP form. The php form connects to a database and posts the content there and it also has some javascript statements.
The problems:
If I edit the drupal node and copy out the PHP and try to save to a document on my computer it warns of a virus.
If I open to edit the drupal node and try to save again (EVEN THO NO CHANGE IS MADE) the form no longer shows up and nothing shows up where it should be in the drupal page.
What could be causing this, poorly written PHP? I'm sure there's no virus.
I'm not sure how to reply directly to your question, so I'm putting it in an answer.
If I open to edit the drupal node and try to save again (EVEN THO NO CHANGE IS MADE) the form no longer shows up and nothing shows up where it should be in the drupal page.
It is possible that you are not saving in PHP format, or do not have access to. The default formats are usually Plain Text, Filtered HTML, or Full HTML and it is discouraged to give inline PHP code processing privileges to users. So for the second part of your question, I'd check that.

TinyMCE image uploader and paths

I'm using the TinyMCE editor and imagemanager to edit pages here. For backup reasons i also have to store a copy of uploaded images in the database.
So after reading the TinyMCE doc i started editing the _Template.php file to biuld my own plugin, and it's stored in
$HOMEDIR\js\tiny_mce\plugins\imagemanager\plugins\CacheToDb\CacheToDb.php
my problem is that i want to access my common functions and classes in "my" $HOMEDIR/inc/ form within CacheToDb.php; however i have problems to point back to /inc/class_database.php from
$HOMEDIR\js\tiny_mce\plugins\imagemanager\plugins\CacheToDb\CacheToDb.php.
I tried to add the following lines on top of ChacheToDb.php
define('__ROOT__', "../../../../");
require_once(__ROOT__."inc/global.php");
require_once(__ROOT__."inc/class_database.php");
Going up 4 folders here because it's apparently included from
$HOMEDIR/js/tiny_mce/plugins/imagemanager/index.php
However, this dosnt work. Every time i try require_one() i always get an empty window when i click the "add image" button in TinyMCE, so i assume a php error message breaks the json response...? Firebug did not reveal any obvious bugs or usefull info at all.
Anyone who had this issue before and know how to include a path without breaking the whole thing?
You should have a closer look into the servers error log in order to check what the error is.

Categories