473,387 Members | 3,781 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Using PHP to manipulate HTML tags

Hello,

I'm very new to PHP, but I'm trying to come up with a way in which I can store HTML tags, or ideally whole .css files in a database, then call these through a link on a webpage, and have the formatting change as a result.

I have managed to get as far as beign able to upload all the schpeel i need into the database, but can't get my head around how to parse this into html via PHP

Any help much appreciated!

Wibble!
Apr 25 '07 #1
3 3129
tolkienarda
316 100+
Hello,

I'm very new to PHP, but I'm trying to come up with a way in which I can store HTML tags, or ideally whole .css files in a database, then call these through a link on a webpage, and have the formatting change as a result.

I have managed to get as far as beign able to upload all the schpeel i need into the database, but can't get my head around how to parse this into html via PHP

Any help much appreciated!

Wibble!
i would love to help
a couple questions first
are these css files that are stored in the database or are they the text that makes up the css files.

now to help here is how you generate html content.
use the print or echo tags

either

[PHP]
echo '<img src="an/image.jpg" />';
[/PHP]
if you display multiple strings then they are coma delimiated
if you want to use the print tag it is the same just replace the echo with with print and new strings are connected with a '.' ok hope this helps

eric
Apr 25 '07 #2
Cheers for the reply sofar!

At the mometn, I've just got individual tags, or options thereof stored, I'm having issues uploading whole files to the database, so as it stands the text that makes up the .css would be the easiest way probably......

Regards

Wibble
Apr 25 '07 #3
tolkienarda
316 100+
Cheers for the reply sofar!

At the mometn, I've just got individual tags, or options thereof stored, I'm having issues uploading whole files to the database, so as it stands the text that makes up the .css would be the easiest way probably......

Regards

Wibble
ok you need a new collom as type BLOB this holds binary information aka files. the easiest way to manage databases on a system is with phpmyadmin. if you don't have it i strongly suggest you get it, it is stable, secure, and totaly free.

now once you have this collom you can add entire files and then use mysql select statements to get these files.

now i do think there is a better way to solve this problem than with mysql. you could have a series of .css files like follows
css1.css
css2.css
css3.css
...

and just save these on your server like you regularly would. then use a php script to determine which one to put in... say you have someone select from a dropdown box which .css file they want. it would send a variable to the
trialscript.htm
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <title>trial thing</title>
  4. </head>
  5. <body>
  6. <form action="phpscript.php" method="post">
  7. <select name="css_skin">
  8. <option value="1">css1</option>
  9. <option value="2">css2</option>
  10. <option value="3">css3</option>
  11. </select>
  12. <input type="submit">
  13. </form>
  14. </body>
  15. </html>
  16.  
phpscript.php
[PHP]
<html>
<head>
<title>page with varying skins</title>
<?
$css=$_POST['css_skin'];
echo "<html tag for css target=", $css, "close the tag>";
?>
</head>
<body>
now this could be the same page that the form was on just for the form action print out <?= PHP_SELF ?>
and then just have that php code at the top of your page
</body>
</html>

[/PHP]

hope this helps

eric
Apr 26 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: James | last post by:
What is the best method for creating a Web Page that uses both PHP and HTML ? <HTML> BLA BLA BLA BLA BLA
3
by: Fabian | last post by:
Ho can I create a function in javascript to dynamically toggle all <em> tags between bold and italic? -- -- Fabian Visit my website often and for long periods! http://www.lajzar.co.uk
5
by: Kathryn | last post by:
Good morning! I am having a problem with a span. I have items, of which I only want to show the first X characters on the screen. If the user prints the page, I want the entire item to print....
11
by: rajarao | last post by:
hi I want to remove the content embedded in <script> and </script> tags submitted via text box. My java script should remove the content embedded between <script> and </script> tag. my current...
32
by: Cornel Bicutzi | last post by:
Hello, What is the difference between HTML and XHTML... Thanks, ------------------------------------------------------------------------ IT Interview Questions :...
2
by: André | last post by:
I've started using elementtree and don't understand how to use it to manipulate and replace nodes. I know how to do this using a simple, but inefficient parser I wrote, but I'd rather learn to use...
1
by: rajakolluri | last post by:
Hi, This is Raja.....i am new joiner of this forum. here is my question. i strucked up in manipulating the tab indexes of image tags and buttons that are defined in html using java script. Here...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.