I'm very new to ColdFusion, I am trying to pull image files from my PC's network directory and display them in an HTML table. This is what I have so far -
<cfdirectory action="list" directory="#ExpandPath('file://///network/path/Share-Install/path')#" name="listRoot">
<cfoutput>
<cfloop query="listRoot">
// Build HTML table here maybe?
</cfloop>
</cfoutput>
If this code is correct its not clear to me how to work with the data brought back from the file/loop. Like I said I'm just now beginning with ColdFusion, so I appreciate any advise with this!
I was using the wrong approach and ended up getting the result I wanted by using <cfimage>.
Here is my code that loops through my directory and displays the images in HTML table -
<cfdirectory action="list" directory="C:\Share-Install\55555" name="listRoot" filter="*.jpg">
<table width="100%">
<tr>
<cfloop query="listRoot">
<tr>
<td ><cfimage action="writetobrowser" source="/Share-Install/55555/#name#" width="300"></td>
</tr>
</cfloop>
</tr>
</table>
Related
why jupyter notebook cannot display html 'table', but other html elements are okay, and how can I solve this problem?
below is my source code and my result
source code
<table style="width:20%">
<tr>
<td> **L1** </td>
<td> 1.1 </td>
</tr>
</table>
result
<tr>
<td> **L1** </td>
<td> 1.1 </td>
</tr>
it only removes tag <table> and does nothing else.
That's interesting, because the table (created by pasting your code) comes out just fine for me:
From my personal experience, I can definitely say that Markdown in jupyter notebooks is somehow volatile/unpredictable when it comes to HTML. For example, I myself have been looking for a fix for Jupyter just arbitrarily doing line breaks in the table header (esp. in formulas) and I have found this fix, but it doesn't work for me at all.
I know this is not particularly helpful, but at least it demonstrates that the table not being rendered correctly in your case was either some unexpected behaviour or some bug which maybe, or maybe not, has been fixed in the course of the last year.
You can also add the magic command before the table tag, which worked for me.
My work uses HTML email templates that uses placeholders to insert information from a separate XML document.
I have been tasked with setting up a new template that will only contain information for the first 2 products and nothing else, but they want me to keep the remaining products in the XML file for 'future-proofing'. I have no idea how to set up the template to limit to the first 2 records. Is there a way to use logical statements in html and would that work?
I don't even know what this type of query is, otherwise I would search myself.
Here is the code for the HTML template:
<table>
<tbody>
<tr id="Line">
<td>
<table>
<tbody>
<tr>
<td><a href="https://www.acompany.uk"> <img src="www.aproduct.uk/[Element1].jpg?></a</td>
</tr>
<tr>
<td>[Element2]</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
And here is an excerpt from the XML that it looks at
<Line>
<Element1>Name 1</Element1>
<Element2>Description 1</Element2>
<UniqueID>1</UniqueID>
</Line>
<Line>
<Element1>Name 2</Element1>
<Element2>Description 2</Element2>
<UniqueID>2</UniqueID>
</Line>
<Line>
<Element1>Name 3</Element1>
<Element2>Description 3</Element2>
<UniqueID>3</UniqueID>
</Line>
When it runs, it will populate the image and description of all products in the document with the <Line> header. But, we only want to use the first 2 records.
N.B I did not set these up myself, the person who did left in a hurry and it's landed in my lap.
Hi all as you can probably tell by my two questions yesterday I'm new to wed development. I really need some help on how to approach the next part of my page. So and advice would be great. I'm not really looking for complete/complex code that I can't understand.. I really just want a point in the right direction so I can then work it out / learn myself. CHEERS :D
Okay so basically I have set up a database user accounts and I want to have a rolling feed of new members... . I want to get the feed to go in the main square, how do I code the feed... For the website so far I have used html and php for coding languages. The server is a mysql server. And tips / pointers would be really helpfull :)
my current code:
<?php
//Account validation
session_start();
if(!(isset($_SESSION['login']))){
header("location:welcome.php");
}
?>
<html>
<body>
<table width ="100%" border="1">
<tr>
<td width="25%">
<h1>TOOB</h1>
</td>
<td>
<!all links and stuff>
</td>
</tr>
<tr>
<td>
<h2>Start exploring the TOOB</h2>
</td>
<td width="75%">
</td>
<td>
<form>
<input type="button" value="Logout" onclick="window.location.href='logout.php'">
</form>
</td>
</tr>
</table>
<br>
<table border="1" align="center" width = "60%" height = "500">
<tr>
<td>
<!--FEED GOES HERE-->
</td>
</tr>
</table>
</body>
</html>
You will need to connect to your mysql database and retrieve your user information. Learn more about PDO, there are plenty of tutorials out there, just google 'php pdo'. When you are done with the connection and the retrieval of your data you will have an array you can loop through and display the rows in your page. For the rolling part, you can use javascript and make an ajax get request every few minutes to refresh the information.
Also please consider using css for creating a layout for your page instead of a table.
Let me know if you need more.
If anyone ever comes across this in future months I have found the solution to what I wanted to do on: http://www.phpsimplicity.com/tips.php?id=1
it teahces you how to limit the results of a mysql function to a certain number of rows. it then moves on to how you can for example output the first ten, then the second group of ten and then the third etc..... I just now have to work out how to put that into a form/display typy thing
I need to do a lot of various search and replaces within A LOT of static html files. One issue I'm coming up with is I'm getting matches in urls when really all I want to search/replace are text nodes.
So that makes regular expressions more difficult and most likely more error prone since you're parsing html with them now.
What's the easiest way to do search/replaces on only text nodes? I'm talking like you can be up and running within a couple minutes with no Master's required in Python-Java-Ruby-Headless-Phantom-PHP-Node-FluxCapacitor.
Please give advice as though you're speaking to a moron.
I'm on Windows 7.
What I'm looking for is something like the search/replace functionality in Notepad++. You give it a directory to start searching, it searches recursively, hitting every type of file you specify (like .html or .shtml) you tell it what to search for and what to replace it with. It runs and 10 or 15 seconds later you might have edited hundreds of files in one fell swoop. You know, dead simple stuff.
So that's what I want to do, but just searching/replacing within text nodes.
SublimeText 2 has some very powerful text searching features that should empower you to be able to do as you are explaining, so whilst i think i can point you in the right direction - I myself am still learning how to use it - but it does have the "find in files" option which means you can grab the selected word in many different files and replace it - but I havn't found a way to exclude the irrelevant ones that may not need changing. Hopefully someone else will come along and enlighten you.
You may want to add the tag "Sublime text 2" to your original post to broaden the audience
You can use Python and HTQL at http://htql.net. Some examples:
page="<html> <body> <table> <tr><td id='cell1'> test1 </td></tr> <tr> <td id='cell2'> test2 </td> </tr> </table> </body> </html>"
import htql
print(htql.query(page, "<td (id='cell1')>:tx &replace('XXXX') "))
#[("<html> <body> <table> <tr><td id='cell1'>XXXX</td></tr> <tr> <td id='cell2'> test2 </td> </tr> </table> </body> </html>",)]
print(htql.query(page, "<td (id='cell1')>:id &replace('ZZZZ') "))
#[("<html> <body> <table> <tr><td id='ZZZZ'> test1 </td></tr> <tr> <td id='cell2'> test2 </td> </tr> </table> </body> </html>",)]
print(htql.query(page, "<td (id like 'cell%')>:tx &replace('YYYY') "))
#[("<html> <body> <table> <tr><td id='cell1'>YYYY</td></tr> <tr> <td id='cell2'>YYYY</td> </tr> </table> </body> </html>",)]
Is there a way to grab things out of the source code of another site directly into your site?
For example, let's say than in a site the following source code exists:
<table ...>
<tr>
<td class=...>...</div></td>
</tr>
<tr>
<td class=....><div align="... class=...>"Interesting string that keeps changing"</div></td>
</tr>
</table>
And we want that Interesting string that keeps changing to appear in our website as well.
you could use php
you use
$html = file_get_contents('url to website');
or use a hidden if you want a javascript function, and then just grab the innerhtml