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.
Related
Is it possible to take a screenshot of the visible part of the website directly as it is seen by user (rendered by by the browser), including any changes made by user (e.g. moved divs, text typed in forms etc.)?
So you open a website, where you can make changes to its content. And there's a button (on the website of course), when you click it, the actual visible part of the website with all the changes you made is saved as an image and for example there goes a popup window where you can type in an email to send this image to, or something like that. Javascript, php, html5 or anything else? Old browsers and ie doesn't matter.
I've searched a lot for the answer, read lots of related articles, but I couldn't find the solution, cause what I need is not the script that would re-render the page like html2canvas, but capture the actual content displayed on the screen.
Any ideas and comments are much appreciated!
This is something that can be extremely tricky.
Essentially your only option of doing this in browser with no extensions or such is to try rendering HTML into the <canvas> tag.
There are several projects which do that, most reliable choices are noted in this SO question's answers: Render HTML in Canvas/WebGL
Note that none of the projects are 100% accurate, but a canvas can be rendered into an image and thus could be saved or emailed by the user like you asked.
is there a way to get a content of an html page or notepad, then display in on my html page to edit and save, where the edits will be permanent and also allow me to view the content like an individual page or in my desktop. using php or javascript?
or to simply put it embed a notepad on my page where i could edit it anywhere i am.
You can open and edit text documents in a browser, using stuff like:
ACE editor;
Tiny MCE.
The idea is that you open desired file via php [file_get_contents], put its raw data into a <textarea> and enhance it with aforementioned plugins.
Then once you submit your edit, you store new raw data into file.
you can use php fopen function and read the content of the file and load it in texteditor and using fwrite function save the content
You sound like you're wanting a personal wiki; wiki engines are built to be user-editable online (and permanently saved after you edit). A personal wiki is just a wiki that only one user uses or has access to.
If you have a server and don't mind having to be online to edit your notes, any wiki software (like MediaWiki). If you want your notes to go with you, even offline, try TiddlyWiki, a one-page wiki built in javascript so it's all one HTML file.
I'm editing an existing template in Joomla and I need to change the menu icons text. In Joomla Administrator, I cannot find the place where I can do this. So, in FireBug I found DIV container that I was searching for. But if I change the text in FireBug, my changes are obviously not saved. Now very basic question is: how can I know the name of PHP or HTML file, where this DIV container is located? Or how can I save my changes?
FireBug will only change web browsers content, it will not affect files on the server. If you know DIV's id you can search for files with this string on the server. To save changes - edit file and save - but on the server.
I use TestWrangler app (I'm on a mac) - open blank TW, click on Search, browse to target a folder to search through. I always search through a copy of my website folders on my hard drive rather than live site files. Search for the text string you're wanting to find which file contains it. Give TW a few seconds or more and it will tell you exactly which file contains the string.
http://www.barebones.com/products/textwrangler/
When you right click on an HTML element and select "Inspect with firebug", on the right hand side of the firebug screen you will see the styles applied to that element, and where it says the line number, if you just hover your mouse over it it will show you the exact location of the file.
Use a file search tool, it is included in most IDE's, if your editor doesn't have such a feature try a file grep tools like wingrep (http://www.wingrep.com/)
I just thought I'd share this as a possible 'answer' as well.
there is a joomla extension that enables you to search through your source code within joomla itself.
Here is the link:
http://extensions.joomla.org/extensions/miscellaneous/development/22858
I'm sure it will come in handy instead of going through the hassle of a complex setup on localhost.
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.
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