TinyMCE image uploader and paths - php

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.

Related

editing WordPress Theme with content embedded in PHP script

I am trying to redo my homepage of my website which is a WordPress website. The homepage is hardcoded in PHP, and I would like to figure out how to
Replace some of the image files
Edit the text under those image files
I have redesigned the (4) image files I want to update the site with, but I don't know where in the script to paste the name of those files. There are tones of file slike index.php, theme,php, and I would figure that under these I would see "front_forecast.png" somewhere where I could erase that and type in the image file name I want there instead, but I haven't had success.
It's going to be a bit hard to help you without seeing some code, your current site, or even knowing what your theme is. As gwillie said though, it might be best to go back to basics first.
From a template pov, I have always found this diagram helpful in understanding how WordPress uses its templates to output content (source: http://codex.wordpress.org/Template_Hierarchy#Visual_Overview):

Find the PHP/HTML file containing DIV container shown in FireBug

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.

WYSIWYG way to work with xyz.tpl.php/CSS files?

I recently purchased a script that I'm trying to change the CSS to pimp it up :)
However since I'm fairly new to CSS/PHP (I've done ASP before), I'm trying to use the "Live view" feature Dreamweaver 5.5 to edit the tpl.php files. I have setup the site as instructed in DW and it's working with basic PHP files, however when I try to open a tpl.php file it doesnt seem to handle all the includes or something, so essentially it doesnt know how to retrieve all the related CSS etc in order to show me what the site looks like.
It has the following code structure:
www.xyz.com -> this calls the index.php
Within index.php, it calls include_once ('global_mainpage.php');
Within global_mainpage.php it then calls $template_output .= $template->process('mainpage.tpl.php');
mainpage.tpl.php is the file that I need to change the layouts/CSS class reference etc.
My ideal way to work with the site is:
Say if I want to change something on index.php
I just click on one of the elements in live view
It would automatically launch the tpl.php file being used
I can then examine the CSS used and make a change to it
hit save and be able to view the change I just made
If this is not possible, do I have no choice but to use Aptana? I've used it before editing PHP code, but not tpl.php - I was hoping to have a WYSIWYG editor for tpl.php...
Many thanks for your help gurus! :)
Why don't you use FireBug on Firefox and hook it up with cssUpdater?

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.

SMF displays raw HTML and PHP on browser

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

Categories