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.
Related
Still new to all of this, not sure if I'm using span class correctly however, I have to "link" this paragraph to a field groupp in wordpress and im not sure how to modify the code correctly.
This is an example of what was meant to be achieved:
<h2><?php the_field('barbarismtitle'); ?></h2>
I can edit this fine in wordpress but Im not sure how I would do the same for this:
<p>After <span class="thebatavia">The Batavia</span> was wrecked, the survivors were left to the dictatorship of <span class="jeronimuscornelisz">Jeronimus Cornelisz</span>, where 125 men, women and children were murdered.</p>
The span is so that only a few words in the paragraph have a certain colour. Any help would be appreciated. (also there aren't spaces in my code, It just wouldn't show otherwise)
Using the span to add a custom class to change the colour of the text is a good idea, if your trying to create a link to another page you will need to use an A tag.
so the php needed to link would look something like this
<p>After The Batavia was wrecked, the
survivors were left to the dictatorship of.....
This is assuming that the_field('barbarismtitle') would return a url to fill the href property
I have a administration corner on my web, where can Admin create and post news.
It's implemented with html alements as helper. Admin clics on buttons and elements helps him, to style his text.
It looks this:
I have an option to Edit existing News as well.
Problem is if I try to assign this html text into my variable in ng-init
It all go bad.
<h4 ng-init="TextAreaText = '<?php if ($_GET["NID"]) $Admin->DrawNewsByID($_GET["NID"]) ?>'"> Editor </h4>
It means if there is NewsID in Get, It selects News text in php and tries to assign it into TextAreaText varible.
But it is shown like this:
Because of my bad quotation marks.
As you can see: - source code from my browser
Is it possible to samehow fix it?
Thanks a lot.
Currently I have a DIV with the name "containerX". The X however can change in any number, depening on the input of the user that submits a value. Based on the number I want to show a certain DIV with values.
Is it possible to create a "if / else" statement in PHP that shows a certain div based on the name.
E.g.
if div name = containter7 then show the following
else if div name = container 8 then show the folloing
and on.
Have tried a lot so far, but can't seem to work it out.
Thnx
Sure thing, assuming you're able to get a variable in PHP that represents the correct div name- There are a few different options, but this would probably be the best (works without too many changes).
Let's say you have the following divs-
<div id='div1'>Some div stuff(1)</div>
<div id='div2'>Some div stuff(2)</div>
<div id='div3'>Some div stuff(3)</div>
In the page's head tag, add a new style for hidden divs:
<style>
div.hidden {
display:none;
}
</style>
Then, change your divs to resemble the following:
<div id='div1' <?php if(divName!="containter1") echo "class='hidden'" ?> >Some div stuff(1)</div>
<div id='div2' <?php if(divName!="containter2") echo "class='hidden'" ?> >Some div stuff(2)</div>
<div id='div3' <?php if(divName!="containter3") echo "class='hidden'" ?> >Some div stuff(3)</div>
That bit of PHP will set each div to the hidden class we made earlier, if the variable divName isn't equal to the right string.
This is by far not the most efficient code, but if you aren't too experienced in PHP (which forgive me for saying, but judging by the phrase if div name = containter7, I would have to assume you're new-ish to the language), then this will get the job done with minimal PHP involvement.
I have a list of common links for product pages, and I need to go through and grab all the links for the product image on each product page.
Eg I have got this far: I have a whole spreadsheet full of links like this
http://www.apc.com/products/moreimages.cfm?partnum=WSYSW100KF
the problem is I need the acutal image links for another column on my spreadsheet (it;s going to be used for a import on a eccomerce shop)
the thing is these image links don't seem to match up in any way and can be quite varied
http://www.apcmedia.com/resource/images/500/Front_Left/98EC66CA-5056-AE36-FE51936B432B1C17_pr.jpg
I have identified though that these images sit in what looks like a common area on the product page code
<div align="center"><img align="center" src="http://www.apcmedia.com/resource/images/500/Front_Left/98EC66CA-5056-AE36-FE51936B432B1C17_pr.jpg"></div>
How can I indetify that <img align="center" src=""> part in Jquery on each page ?
I'm thinking if I iterate through all those links, then I can grab the releavnt direct Image link, grab it and repopulate into another spreadsheet column.
I'm just not 100% on how to achieve this, any advice would be greatly appreciated.
Thanks
Use this selector to select the relevant images:
var result = [];
$("div[align=center] > img[align=center]").each(function(){
var link = $(this).prop("src");
//Do something, eg:
result.push(link);
});
//result is a list which hold all links
.prop() returns the absolute URL of an image, even when the src attribute contains a relative URL.
A > B selects every element B which is an immediate child of A.
If your src attribute* follows a certain pattern, you can also use the following selector:
$("div[align=center] > img[src^='http://path/to/images'][src$='.jpg']");
//src^= means: Match if the `src` attribute starts with ...
//src$= means: Match if the `src` attribute ends with ...
I have an interesting question, or atleast I think it is.
I have this website http://21-card-games.com/best/casino-reviews/casino-casino-titan.asp. You will see the image and below it the content.
Is it possible to combine the image with the text and left align the image and make the text flow next to the image.
The pages are all dynamically created, The content on the page is a variable that I import from a mysql db...
Here is some of the coding:
<div id="yui-main"><div class="yui-b"><?php echo $g_page_content2 ?><br />
<?php include($_SERVER['DOCUMENT_ROOT'].'/includes/standard_images_screenshot_1.php');?><?php echo $g_content_text1 ?>
<?php /* This is the second banner for this page */ include($_SERVER['DOCUMENT_ROOT'].'/includes/banners/'.$row_rs_settings['g_sites_affiliate_ads2'].'.php');?></div>
The $g_content_text1 is the variable that pulls in the text, and the '/includes/standard_images_screenshot_1.php' is the image. The include image file is part of a script that creates the image on the fly (imagick).
However this is more or less what I where thinking:
to create a regex that replaces the first occurance of <p> with this include($_SERVER['DOCUMENT_ROOT'].'/includes/banners/'.$row_rs_settings['g_sites_affiliate_ads2'].'.php' but I am not sure if the php will still execute if I do that...
Any ideas on how I can accomplish this would be appreciated.
I don't get it.
Why you want to create a regexp to let the text flow on the left of the image?
This is a css issue.
Just add float:left to the image.