How to replace text inside a PHP Document? - php

I am making a wordpress plugin, you can edit a page's title with it.
The title will be an H1 Tag with the ID of featuredTitle.
<h1 id="featuredTitle">This text will be replaced!</h1>
Now I need an input that opens the file "myPage.php" and replaces the text.
I am new to PHP so help would be highly appreciated.

Related

In Dynamic contents, complete all the incompleted html tags with jQuery

I want to check all those elements in my page which are not enclosed within the html tags properly. for example i have the following scenario:
This is the picture of my village <img src="path_to_image" <br> some other text.....
Here in the above string in the page which also contained the tag after the image tag in the string and want to complete it with jQuery.
Please also note that the contents are displayed on my page from mysql database table.
Any help will be appreciated. thanks
try and run your markup through a validator:
https://validator.w3.org/

magento product attribute with wysiwyg, src="{{media url="image.jpg"}} not parsed

Hi I'm working with Magento 1.7
I create a text area attribute with wysiwyg allowed and visible on the product page.
when I insert an image I can see only the html text of the attribute, images don’t appear.
If I analyse the generated html code, I can see that the code included by the wysiwyg editor like
src="{{media url="image.jpg"}}
has not been parsed.
The code I use is:
echo $ _Product-> getData ('technical_support');
I tried to print the attribute with
echo $this->helper('cms')->getBlockTemplateProcessor()->filter($this->helper('catalog/output')->productAttribute($this->getProduct(), nl2br($_technical_support), 'technical_support') );
But the attribute is not printed
How can I fix it?
Thanks for your help.
This is how u have to call the images through wysiwyg editor. You have to click show/hide button. Then u can write html tags there. Here is the example
<p class="home-callout"><img src="{{skin url='images/ph_callout_left_rebel.jpg'}}" alt="" /></p>
Flower brackets are missing in ur code.
And for attribute, your process is wrong.. Follow this link Calling an attribute in a CMS block in magento

how to get a text that is in a div id

hi im new to this website im trying to get a title in my forum without pasting it again in the forum < div class="titleBar" >
so bassicaly what i need is that some code that will get what ever is in that div for example
http://desiztv.com/index.php?threads/watch-colors-live-online-for-free.68/
the title is "Watch Colors Live Online For Free"
i need some code that i will post in the post and it will get the title it self and i can do that with every post pleae help me with it thankx :)
You could simply store the text value in a variable to use wherever you want...
<div id="mainTitle>Watch Colors Live Online For Free</div>
Using jQuery and JavaScript, we initialize a new variable called title.
var title = '';
Now as soon as your text has been inserted into your #mainTitle div element, you can retrieve the text content of that div using this -
title = $("#mainTitle").text();
Your title variable is then available for you to use anywhere you want to copy that text -
$("#someElement, #anotherElement, #yetAnotherElement").text(title);
All three elements -
<div id="someElement">Watch Colors Live Online For Free</div>
<div id="anotherElement">Watch Colors Live Online For Free</div>
<div id="yetAnotherElement">Watch Colors Live Online For Free</div>
will now contain the same text as the first #mainTitle element.

Wordpress - I want to add a <div></div> with a Plugin

I'm trying to learn wordpress and php.
Basically, I want the
function draw_ad() {
echo "IMAGE CODE INSIDE A DIV";
// echoing an image inside a div -- StackOverflow does not allow me to post img tags : )
}
add_action('the_content', 'display_ad');
===
Basically, I want to add a picture and be able to manipulate the "left" and "top" css options... but with a plugin. So it will be like a strange picture that covers whatever the area on the screen that I want it to cover :P.
Yes, it is kind of sloppy, but that's what I was asked to do : P.
The add_action('the_content', 'display_ad') kind of does it, but it removes the whole content.
Is there a better way to do this?
Is there a way to tell the wordpress PLUGIN to add this , say, before the theme's header, and not content? (As in, be able to put this thing wherever you want to in the html body tags?
Thank you, guys!
From theme developing I am sure you can add code to the header and at the end of the body tag. (wp-header, wp-footer)
The best thing is to insert the picture tag at the end of the body and style it with position:fixed;. You don't need a div around the img tag.

jQuery/PHP Replace Text with Title

Trying to replace the Text inside an <h1> with the text inside the <title> with jQuery.
$('.pagination').each(function(
$('.pagination h1').replace($("html head title").text(););
);
I don't really know how to do this, I sorta hacked it together.
EDIT: Or, does anyone know how to do this with PHP?
You can get the title of the page using document.title. Instead of using .each you can just target all h1 tags.
$('.pagination h1').text(document.title);
In JavaScript:
$('h1').text($("title").text());
Replaces every h1 text in the document with the text inside the title tag.
$('h1').html( $('title').text() );
should do it
Here you go :
title=document.title;
$("h1").html(title);

Categories