473,946 Members | 1,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using PHP to manipulate HTML tags

2 New Member
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 3156
tolkienarda
316 Contributor
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
wibblefish
2 New Member
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 Contributor
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
4245
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
4649
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
29714
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. Thanks to Els, I have a way to do this, see below, directly from the View Source: This is a long piece of text. This is a long piece of text. This
11
3099
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 code is function RemoveHTMLScript(strText) { var regEx = /<script\w*<\/script>/g
32
2977
by: Cornel Bicutzi | last post by:
Hello, What is the difference between HTML and XHTML... Thanks, ------------------------------------------------------------------------ IT Interview Questions : http://www.geekinterview.comIT Tutorials and Articles : http://www.geekarticles.com
2
7104
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 a better tool - especially as it is to be added to the standard library. I'll use a simple, but representative example. Suppose I have the following text, where I inserted blank lines to isolate the part I want to manipulate....
1
1746
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 is the kind of logic needs to be implemented. i have main screen with 3 sub sections. 1. main screen has 3 images tags and 3 submit button's. the Tab order that these elements follows : first 3 image butons and 3 submit buttons and even based...
0
9981
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11564
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11153
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10686
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9886
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8250
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6111
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4940
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3541
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.