PHP - Add Style Color To Links?
Hi there!,
I am trying to figure out how to use preg_replace or preg_match. I want to search a text block and add a color style to all the links. How is this possible? Code: [Select] Logical Example: Search - > "<a href="whatever.php?id=123&sid=2312">" and replace with <a href="whatever.php?id=123&sid=2312" style="color: rgb(255, 250, 255);"> Similar Tutorials<html> <?php $id = $_GET['id']; $dbusername="web148-matt"; $dbpassword="matt"; $dbdatabase="web148-matt"; mysql_connect(localhost,$dbusername,$dbpassword); @mysql_select_db($dbdatabase) or die( "Unable to select database"); mysql_query("UPDATE count SET clicks=clicks+1 WHERE id='$id'"); $sql = mysql_query("SELECT link FROM count WHERE id='$id'"); $fetch = mysql_fetch_row($sql); $result = mysql_query("SELECT * FROM count"); while($row = mysql_fetch_array($result)) { echo "<a href=" .$row['link']. ">Link</a>"; } ?> <a href='http://www.google.com'>Google</a> <a href='/index.php?id=2'>link2</a> </html> onkeydown="this.style.fontStyle='normal';"How can I add color: #000; to this? Thanks, Hello everyone! I need a little help to get functions names from the GD library. first i want to say i have a little knowledge with GD library like create image with words and etc. So , what i'm trying to do is to take image and than take the color of the first pixel on the top left than do some function work and than set this pixel on the top left to another color. now , i know how the algorithm should look like , i just don't know what function i need to use to: take specific pixel color from the image set new color for pixel on specific place i'll be glad if you could help me with that , regards , Mor. So I have been working on my website for a while which all is php&mysql based, now working on the social networking part building in similar functions like Facebook has. I encountered a difficulty with getting information back from a link. I've checked several sources how it is possible, with title 'Facebook Like URL data Extract Using jQuery PHP and Ajax' was the most popular answer, I get the scripts but all of these scripts work with html links only. My site all with php extensions and copy&paste my site links into these demos do not return anything . I checked the code and all of them using file_get_contents(), parsing through the html file so if i pass 'filename.php' it returns nothing supposing that php has not processed yet and the function gets the content of the php script with no data of course. So my question is that how it is possible to extract data from a link with php extension (on Facebook it works) or how to get php file executed for file_get_contents() to get back the html?
here is the link with code&demo iamusing: http://www.sanwebe.c...-php-and-jquery
thanks in advance.
Background:
Question:
My experience: Code Examples:
function getInfo(ProductNumber){ $.ajax({ url:'Ajax-PHP-Page.php?ProductNumber='+ProductNumber, success: function(html) { document.getElementById("my_div").value = ''; document.getElementById("my_div").value = html; } }); }
function getInfo(ProductNumber) { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { document.getElementById("my_div").value = this.responseText; } }; xmlhttp.open("GET","Ajax-PHP-Page.php?ProductNumber="+ProductNumber,true); xmlhttp.send(); } Thank you!! Edited May 5, 2020 by StevenOliverWell I tried adding a border to my online users box... But there are some problems.. echo "<div style="width:200px;height:100px;border:2px outset blue>$users</div>"; the ; and " in the css stuff up the php - so I get errors like this Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/scswc188/public_html/index.php on line 23 Is there a way to do this? any tutorials? Thanks Hi there, I have the following code: <?php include 'config.php'; include 'opendb.php'; $query = "SELECT shop_name, street_name, town, postcode, contact_number, web_address, user_email FROM user_info"; $result = mysql_query($query); while($row = mysql_fetch_row($result)) { $shop_name = $row[0]; $street_name = $row[1]; $town = $row[2]; $postcode = $row[3]; $contact_number = $row[4]; $web_address = $row[5]; $user_email = $row[6]; echo "<h5>Name:</h5>$shop_name <br>" . "<h5>Address</h5>$street_name <br>" . "$town <br>" . "$postcode <br>" . "<h5>Contact Details</h5>Phone Number:$contact_number <br>" . "Web Address: $web_address <br>" . "Email : $user_email <br><br>"; } include 'closedb.php'; ?> But i want to make the echo return in a box which is created by the div in the css? How do i do this? Please Help!!! I have an echo here, and not sure where about's I can put <br /> and want to be able to style it in the css (need to create a div class or something on it) Thank You Code: [Select] echo 'address="' . parseToXML($row['address']) . '" '; Hello! Quick question which I hope someone will be able to answer! How do I apply this style Code: [Select] <style type="text/css"> .text { font-family: Arial, Helvetica, sans-serif; color: #666; font-size: 12px; font-weight: normal; text-decoration: none; margin-right: 15px; } </style> to the code below, which will become text in an PHP generated HTML email Code: [Select] $message .= "Dear ".clean_string($Name).",\n\n"; $message .= "Thank you for your message.\n\n"; I beleive I need to use a css span class but can't get it to work! Thanks! Hi, I use the following style for building my websites, I understand this is a fairly common style and was wondering if there is a name for it? Code: [Select] <?php include ('application.php'); include ('cms_config.php'); include ('templates/header.php'); switch ($_GET['action']) { case "home" : display_home(); break; case "services" : display_services(); break; case "testimonials" : display_testimonials(); break; case "contact" : display_contact(); break; default : display_home(); break; } include ('templates/footer.php'); // Function list // Display home page function display_home(){ $qid = mysql_query('SELECT * FROM testimonials ORDER BY RAND() LIMIT 0,1;'); include('templates/home.php'); } // Display services page function display_services(){ include('templates/services.php'); } // Display testimonials page function display_testimonials(){ $qid = mysql_query('SELECT * FROM Testimonials'); include('templates/testimonials.php'); } // Display home page function display_contact(){ include('templates/contact.php'); } ?> Hi,
I am trying to align sections of my CSS layout side-by-side, but I am having problems with it.
I expect the left sidebar (#aside) with a 30% width to meet with the content section (#content) of the width of 70%. But, the changes I make are not translating as expected.
See attached screenshort of what is happening and the CSS code bellow:
#container { margin: 0 auto; width: 800px; background: #fff; } #header { background: #5a83c3; padding: 20px; } #header h1 { margin: 0; } #navigation { float: left; width: 100%; background: #d1dceb; border-top: 1px solid #fff; } #navigation ul { margin: 0; padding: 0; } #navigation ul li { list-style-type: none; display: inline; } #navigation li a { display: block; float: left; padding: 5px 10px; color: #fff; text-decoration: none; border-right: 1px solid #fff; } #navigation li a:hover { background: #383; } #content-container { float: right; width: 100%; background: #FFF url(layout-two-liquid-background.gif) repeat-y 68% 0; } #content { clear: right; float: right; width: 70%; padding: 10px 0; margin: 0 0 0 4%; display: inline; background: #dfe6ef; border-top: 1px solid #fff; border-left: 1px solid #fff; border-bottom: 1px solid #fff; } #content h2 { margin: 0; } #aside { float: left; width: 20%; padding: 10px 0; margin: 0 3% 0 0; display: inline; background: #d1dceb; border-top: 1px solid #fff; } #aside h3 { margin: 0; } #footer { clear: right; background: #d1dceb; text-align: right; padding: 20px; width: 68%; float: right; overflow: hidden; } #footer p.left { float: left; text-align: left; margin-left: 5px; } #footer p.right { float: right; text-align: right; margin-right: 5px; }Attached Files screenshort.png 90.3KB 0 downloads I basically would like to style the third and fourth echo, could i give it a ID then style it in css, how would i do this? any help is appreciated. my php code: Code: [Select] { $i = 0; echo '<div style="font-family:helvetica; font-size:15px; padding-left:15px; padding-top:20px;">'; while($row = mysql_fetch_array($result)) { // Loop through results $i++; echo '<img class="image1" src="'. $row['images'] .'" />'; //image echo "Displaying record $i<br>\n"; echo "<b>" . $row['id'] . "</b><br>\n"; // Where 'id' is the column/field title in the database echo "Location: ". $row['Location'] . "<br>\n"; // Where 'location' is the column/field title in the database echo "Property Type: ". $row['Property_type'] . "<br>\n"; // as above echo "Bedrooms: ". $row['Number_of_bedrooms'] . "<br>\n"; // .. echo "Purchase Type: ". $row['Purchase_type'] . "<br>\n"; // .. echo "Price: ". $row['Price_range'] . "<br>\n"; // .. } How can I style this drop-down list/box in IE, so it looks the same as how I have it in Chrome?
(see attached images)
Howdy ya'll . . .
I am a new member here. My background with html & css is all self-taught, but I have no knowledge of PHP so I am here looking for some expert help with a problem I am having with a comments script that I have on some of the pages of my new website. So, because of my ignorance when it comes to PHP, please be gentle with me. LOL
So here is my problem:
I am using the comments script from Script Mills in the sidebar of my website.
I have overcome the first big obstacle - got it installed and working.
I posted a test comment and it worked, but I do not like the way the posted comment shows on the page.
I have searched all the script folders for a style sheet and can't find one. So my question is: how does one go about styling/changing the way the output of a script like this posts to the page?
If you need to see what I am talking about, the page http://pickmysmoker....smoker_1280.php and if it will help to understand what I am trying to do, feel free to post anything to the comment and see how it posts.
In particular, I would like to move the comments further down in the sidebar and utilize more of the sidebar area so that the comments take up more of the width.
I hope my question makes sense and there is someone here that can offer me some help/advice/guidenance in getting this squared away.
Thanks in advance . . .
Hello) I write html "library" for my php App in function style. But I think in OOP style will be better What do think about first and second variant. Maybe I wrote something wrong in OOP style ? /** * Create a link in button style. * @param string $txt name * @param stting $url link * @param string $title title if is empty then title = $txt * @param boolean $render if this option is true then render html object else return it */ if (!function_exists('uiButton')) { function uiButton($txt,$url,$title=NULL,$render=TRUE) { if(empty($title)) $title = $txt; // If $output is true then render else return $output if($render) echo '<span class="btn"><a href="'.$url.'" title="'.$title.'">'.$txt.'</a></span>'; else return $output; } } /** * Create a href link * @param string $txt name * @param stting $url link * @param string $title title if is empty then title = $txt */ if (!function_exists('uiLink')) { function uiLink($txt,$url,$title=NULL,$render=TRUE) { if(empty($title)) $title = $txt; $output = '<a href="'.$url.'" title="'.$title.'">'.$txt.'</a>'; // If $output is true then render else return $output if($render) echo $output; else return $output; } } if (!function_exists('uiHeading')) { function uiHeading($txt,$h='1',$render=TRUE) { $output = '<h'.$h.'>'.$txt.'</'.$h.'>'; if($render) echo $output; else return $output; } } if (!function_exists('uiBr')) { function uiBr($num = 1) { echo str_repeat("<br />", $num); } } if (!function_exists('uiNbsp')) { function uiNbsp($num = 1) { echo str_repeat(" ", $num); } } if (!function_exists('uiImg')) { function uiImg($src,$align=NULL,$alt=NULL,$border=NULL,$width=NULL,$height=NULL,$render=TRUE) { $output .= '<img '; $output .= 'src="'.$src.'" '; if(!empty($align)) $output .= 'align="'.$align.'" '; if(!empty($border)) $output .= 'border="'.$botder.'" '; if(!empty($width)) $output .= 'width="'.$width.'" '; if(!empty($height)) $output .= 'height="'.$height.'" '; if(!empty($alt)) $output .= 'alt="'.$alt.'" '; else $output .= 'alt=""'; $output .= ' />'; // If $output is true then render else return $output if($render) echo $output; else return $output; } } exemple first variant uiImg('http://site.com/img/img.png','','','',640,480,$render=TRUE) { and second variant class HTML { var $name; var $url; var $action; var $method = 'post'; var $width; var $hight; var $alt; var $title; var $align; var $class; var $id; var $style; var $border; var $value; function link() { echo '<a href='.$this->url.'>'.$this->name.'</a>'; } function formOpen() { echo '<form action="'.$this->action.'" method="'.$this->method.'">'; } function img() { $output = ''; $output .= '<img '; $output .= 'src="'.$this->url.'" '; if(!empty($this->align)) $output .= 'align="'.$this->align.'" '; if(!empty($this->border)) $output .= 'border="'.$this->border.'" '; if(!empty($this->width)) $output .= 'width="'.$this->width.'" '; if(!empty($this->height)) $output .= 'height="'.$this->height.'" '; if(!empty($this->alt)) $output .= 'alt="'.$this->alt.'" '; else $output .= 'alt=""'; $output .= ' />'; echo $output; } } $img = new HTML(); $img->url = 'http://site.com/img/img.png'; $img->width = 640; $img->height = 480; $img->img(); I need to echo <link rel="stylesheet" type="text/css" href="css/style.css" /> But! i need it to check the mysql database if the row pagestyle is empty it will echo <link rel="stylesheet" type="text/css" href="css/style.css" /> If not then it will echo <link rel="stylesheet" type="text/css" href="css/style.<? echo $pagestyle; ?>.css" /> //$x = ereg_replace('[-a-z0-9!#$%&\'*+/=?^_`{|}~]+@([.]?[a-zA-Z0-9_/-])*','<a href=\'mailto:\\0\' '.$style.'>\\0</a>',$x); This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=314049.0 Ok guys, I'm gonna have to throw a question out there. I am building a mmorpg. And I could use some help with some coding. I have two cron files that run every hour and every day(24 hrs ) My question is, how can I add a visual countdown based on server time to show how long the cron has left to tick? I have tried many countdowns but most of them reset once I leave the page. So basically I need a countdown timer to show the user how long till he getts more food or whatever. Any help would be greatly appreciated. Thank you in advance for taking time to read and/or help. example : Code: [Select] <?php code; ?> how to change CSS (i guess this is the method) using php or javascript to organize text/code like <code></code> here ! i did a search and didnt found anything useful! |