Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HTML Editor makes code changes
#1
I do all my coding in Sublime Text 2 and then paste it into the HTML Editor using the source tab.
The problem that I am having is the code gets changed, for instance;

<a tabindex="1"><?php get_site_url(); ?><img src="<?php get_theme_url(); ?>/img/orchid.jpg"></a>
becomes
<a tabindex="1"><!--?php get_site_url(); ?--><img src="&lt;?php get_theme_url(); ?&gt;t;/img/orchid.jpg" /></a>

basically it's <?PHP becomes <!--?php and ?> becomes ?-->

Even if I manually code it into the editor, it will change as soon as I hit save.

I am using v3.2.3.
The wiki suggests creating a config file for this but,never having created a config file, I wouldn't know where to start. Are there any settings that address the sort of problem I am seeing and how would I implement them.

thanks for your help.
I'm no Einstein, nor do I profess to be. Just saying what I would try in the circumstances.
Reply
#2
You cannot put php in page contents.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#3
Well, that certainly explains that one Shawn Big Grin
So I need to write my path in full?

thanks
I'm no Einstein, nor do I profess to be. Just saying what I would try in the circumstances.
Reply
#4
Depends on what you are trying to do.

Could go in a new template in your theme, could go in a component.
You can use dynapages plugin to add component shortcodes.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#5
I found this nice gallery that I want to add

alpatriott.ru/works/album/album-mod.html

Basically, the HTML code is

<div class="gallery">

<a tabindex="1"><img src="http://mysite/theme/mytheme/img/image1.jpg"></a>
<a tabindex="1"><img src="http://mysite/theme/mytheme/img/image2.jpg"></a>
<a tabindex="1"><img src="http://mysite/theme/mytheme/img/image3.jpg"></a>
<a tabindex="1"><img src="http://mysite/theme/mytheme/img/image4.jpg"></a>

</div>

I was trying to add it to a blank template page.

The images will all be in the same folder (obviously) so I don't want to keep adding the full path.
I want to be able to quickly go in and change the image if necessary.

I don't necessarily want to use someone elses plugin, I want to use it as a learning tool. My PHP is lacking somewhat Smile

thanks
I'm no Einstein, nor do I profess to be. Just saying what I would try in the circumstances.
Reply
#6
Just use relative urls.
../../data/uploads/
Or something like that
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#7
@lucianp

I think you mean something like this:

Code:
<?php
$myimages = array('image1.jpg','image2.jpg','image3.jpg','image4.jpg');
?>

<div class="gallery">
<?php foreach($myimages as $myimage) { ?>
<a tabindex="1"><img src="<?php get_theme_url(); ?>img/<?php echo $myimage; ?>"></a>
<?php } ?>
</div>

(Not tested.)
Reply
#8
Thank you Shawn and Carlos,
having thought a bit harder and a bit longer about what I am trying to do, I realized I would need a backend for image manipulation, so I added a plugin to my site and will use that to learn from.

I'm beginning to see PHP can be fun Big Grin
I'm no Einstein, nor do I profess to be. Just saying what I would try in the circumstances.
Reply
#9
Hello,

I have a similar problem.

I want to use FontAwesome icons as bullets in a unordered list environment, but when I paste this code into the HTML editor:

Code:
<ul class="fa-ul">
    <li><i class="fa-li fa fa-hand-o-right"></i>Current teaching info</li>
    <li><i class="fa-li fa fa-hand-o-right"></i>How to get to my office</li>
</ul>

the smart editor transforms it into this:

Code:
<ul class="fa-ul">
    <li>Current teaching info</li>
    <li>How to get to my office</li>
</ul>

Is there any way to prevent the smart editor from "cleaning" the code??

Is there any way to disable the smart editor, and to work only with raw HTML?
--
vicent
Reply
#10
(2013-12-11, 16:41:28)vginer Wrote: Is there any way to disable the smart editor, and to work only with raw HTML?

Yes: go to Settings and untick "Enable the HTML editor"
Reply
#11
(2013-12-11, 16:50:26)Carlos Wrote:
(2013-12-11, 16:41:28)vginer Wrote: Is there any way to disable the smart editor, and to work only with raw HTML?

Yes: go to Settings and untick "Enable the HTML editor"

@Carlos, thank you!!

And another one: Is there a way to change the default font (Arial-like) of the raw HTML editor (to a monospaced one)?
--
vicent
Reply
#12
Ckeditor removes empty tags
There is a way to fix this, but youll have to search the forums.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#13
See
http://ckeditor.com/forums/CKEditor-3.x/...ty-tags-eg.

I do not think this is fixable in our cke version.

You might want to try the cke patch branch of GS which runs cke4+, it might be more html5 friendly.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#14
Actually never mind

Fixed
CKEDITOR.dtd.$removeEmpty.i = 0;

Add that to your config.js, you can also add .span etc.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#15
To modify the plaintext textarea, use the custom admin css plugin

Code:
textarea#post-content {
    font-family: Consolas, Monaco, "Courier New", Courier, monospace;
    tab-size:4;
     -moz-tab-size:4;
     -o-tab-size:4;     
}
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#16
(2013-12-12, 01:25:23)shawn_a Wrote: Actually never mind

Fixed
CKEDITOR.dtd.$removeEmpty.i = 0;

Add that to your config.js, you can also add .span etc.

Thank you! So, do you mean this is already solved??
--
vicent
Reply
#17
Thats the solution, works for me.
Might need to test it in your scenario, I only tested it on the beta version, not stable.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#18
(2013-12-12, 01:28:17)shawn_a Wrote: To modify the plaintext textarea, use the custom admin css plugin

Code:
textarea#post-content {
    font-family: Consolas, Monaco, "Courier New", Courier, monospace;
    tab-size:4;
     -moz-tab-size:4;
     -o-tab-size:4;     
}

Thank you. I installed Custom Admin CSS, and used your code in order to customize the text area appearance. At the beginning it didn't work, at least on my browser (Chrome), but I removed all carry returns and it worked! Smile
--
vicent
Reply
#19
Did you try the ckeditor fix yet?
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#20
(2013-12-13, 00:23:13)shawn_a Wrote: Did you try the ckeditor fix yet?

No, I finally decided to disable it after reading several posts in the forum, because that way I am sure that my code is not altered.

Thank you anyway.
--
vicent
Reply




Users browsing this thread: 1 Guest(s)