|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
php5 - Iframes and sqlcontent
For the admin side of a project some of the content is so long that it scrolls forever. Since this is just the display of the index i want to make it smaller so admins can find the specific entry they want to edit.
So basicly i want to have a Iframe for the long content to load into but the long content isn't a seperate html page just a mysql data pull any way i can load that data dynamicly into a iframe?
__________________
29 years of creative writing 13 years of HTML 10 years of Photoshop 6 years of PHP/MySQL And I never knew Photoshop could do HTML until 2004! You learn something new every day. |
|
#2
|
|||
|
|||
|
I think you could just wrap that part of the content with div tags, set a height on them, then set overflow to auto on the div... that will lock the div height, and add a scroll bar for anything longer. Effectively the same as an iframe.
Quick Example Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
#scrolling {
height: 200px;
overflow: auto;
}
</style>
</head>
<body>
<p>Just a test</p>
<div id="scrolling">
<table border="0" cellspacing="0" cellpadding="0" width="600">
<tbody>
<tr>
<td align="left"><p>The Bill of Rights: A Transcription</p>
<p>The Preamble to The Bill of Rights</p>
<p><strong>Congress of the United States</strong><br />
begun and held at the City of New-York, on<br />
Wednesday the fourth of March, one thousand seven hundred and eighty nine.</p>
<p><strong>THE</strong> Conventions of a number of the States, having at the time of their adopting the Constitution, expressed a desire, in order to prevent misconstruction or abuse of its powers, that further declaratory and restrictive clauses should be added: And as extending the ground of public confidence in the Government, will best ensure the beneficent ends of its institution.</p>
<p><strong>RESOLVED</strong> by the Senate and House of Representatives of the United States of America, in Congress assembled, two thirds of both Houses concurring, that the following Articles be proposed to the Legislatures of the several States, as amendments to the Constitution of the United States, all, or any of which Articles, when ratified by three fourths of the said Legislatures, to be valid to all intents and purposes, as part of the said Constitution; viz.</p>
<p><strong>ARTICLES</strong> in addition to, and Amendment of the Constitution of the United States of America, proposed by Congress, and ratified by the Legislatures of the several States, pursuant to the fifth Article of the original Constitution.</p>
<p><strong>Note</strong>: The following text is a transcription of the first ten amendments to the Constitution in their original form. These amendments were ratified December 15, 1791, and form what is known as the "Bill of Rights."</p>
<hr size="1" noshade="noshade" />
<p><a name="1" id="1"></a>Amendment I</p>
<p>Congress shall make no law respecting an establishment of religion, or prohibiting the free exercise thereof; or abridging the freedom of speech, or of the press; or the right of the people peaceably to assemble, and to petition the Government for a redress of grievances.</p>
<hr size="1" noshade="noshade" />
<p><a name="2" id="2"></a>Amendment II</p>
<p>A well regulated Militia, being necessary to the security of a free State, the right of the people to keep and bear Arms, shall not be infringed.</p>
<hr size="1" noshade="noshade" />
<p><a name="3" id="3"></a>Amendment III</p>
<p>No Soldier shall, in time of peace be quartered in any house, without the consent of the Owner, nor in time of war, but in a manner to be prescribed by law.</p>
<hr size="1" noshade="noshade" />
<p><a name="4" id="4"></a>Amendment IV</p>
<p>The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no Warrants shall issue, but upon probable cause, supported by Oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized.</p>
<hr size="1" noshade="noshade" />
<p><a name="5" id="5"></a>Amendment V</p>
<p>No person shall be held to answer for a capital, or otherwise infamous crime, unless on a presentment or indictment of a Grand Jury, except in cases arising in the land or naval forces, or in the Militia, when in actual service in time of War or public danger; nor shall any person be subject for the same offence to be twice put in jeopardy of life or limb; nor shall be compelled in any criminal case to be a witness against himself, nor be deprived of life, liberty, or property, without due process of law; nor shall private property be taken for public use, without just compensation.</p>
<hr size="1" noshade="noshade" />
<p><a name="6" id="6"></a>Amendment VI</p>
<p>In all criminal prosecutions, the accused shall enjoy the right to a speedy and public trial, by an impartial jury of the State and district wherein the crime shall have been committed, which district shall have been previously ascertained by law, and to be informed of the nature and cause of the accusation; to be confronted with the witnesses against him; to have compulsory process for obtaining witnesses in his favor, and to have the Assistance of Counsel for his defence.</p>
<hr size="1" noshade="noshade" />
<p><a name="7" id="7"></a>Amendment VII</p>
<p>In Suits at common law, where the value in controversy shall exceed twenty dollars, the right of trial by jury shall be preserved, and no fact tried by a jury, shall be otherwise re-examined in any Court of the United States, than according to the rules of the common law.</p>
<hr size="1" noshade="noshade" />
<p><a name="8" id="8"></a>Amendment VIII</p>
<p>Excessive bail shall not be required, nor excessive fines imposed, nor cruel and unusual punishments inflicted.</p>
<hr size="1" noshade="noshade" />
<p><a name="9" id="9"></a>Amendment IX</p>
<p>The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.</p>
<hr size="1" noshade="noshade" />
<p><a name="10" id="10"></a>Amendment X</p>
<p>The powers not delegated to the United States by the Constitution, nor prohibited by it to the States, are reserved to the States respectively, or to the people.</p>
<p><a href="/exhibits/charters/constitution_amendments_11-27.html"><strong>Amendments 11-27</strong></a></p>
<hr size="1" noshade="noshade" />
<strong>Note:</strong> The capitalization and punctuation in this version is from the enrolled original of the Joint Resolution of Congress proposing the <a href="/exhibits/charters/bill_of_rights.html">Bill of Rights</a>, which is on <a href="/nae/visit/">permanent display in the Rotunda of the National Archives Building</a>, Washington, D.C. </td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
Last edited by MatthewJ : October 12th, 2009 at 03:15 PM. |
|
#3
|
|||
|
|||
|
Quote:
I don't suppose you know how to use the overflow with the style defined per div as apposed to a global CSS |
|
#4
|
|||
|
|||
|
Quote:
I get it now Post the code for the div in question... mainly you should just need to add height: 200px; overflow: auto; into the style for said div. Last edited by MatthewJ : October 12th, 2009 at 03:37 PM. |
|
#5
|
|||
|
|||
|
sure, right now it looks something like this
echo '<B>Teaser:</B> <BR><DIV height=300 overflow=auto>'.$MainArray['Teaser'].'</DIV><BR>'; |
|
#6
|
|||
|
|||
|
for any css that you want to do inline with a tag you use the style attribute like so:
<div id='whatever' style='overflow:auto;'>something</div> the css inside the style attribute is pretty much any css that goes between the braces { and } at the top of a page after selecting an element. |
|
#7
|
|||
|
|||
|
Quote:
must be doing something wrong this created a horizontal scroll dive but doesnt restrict the height echo '<B>Teaser:</B> <BR><DIV id=\'Teaser'.$MainArray['ContentID'].'\' height=300 style=\'overflow:auto;\'>'.$MainArray['Teaser'].'</DIV><BR>'; Also when their "bad" content it can break the page, that the main reason i wanted to use a iframe as a iframe wont break the layout around it if codded badly. Any thoughts on these 2 issues? |
|
#8
|
|||
|
|||
|
Code:
echo '<B>Teaser:</B> <BR><DIV id=\'Teaser'.$MainArray['ContentID'].'\' style=\'overflow: auto; height: 300;\'>'.$MainArray['Teaser'].'</DIV><BR>'; That should work... When using height=... within the table tag itself, it is an attribute of the table tag. It needs to be contained within the style attribute. If there is bad content, I personally would check for that before displaying it and provide a message to that effect if it is bad. You could though use your iframe approach, just move the logic to query and display that content into it's own page and set it as the iframe source. Last edited by MatthewJ : October 13th, 2009 at 04:53 PM. |
|
#9
|
|||
|
|||
|
Quote:
when i say bad i mena like unterminated tables, divs, etc. i don't think you can check for that before posting |
|
#10
|
|||
|
|||
|
the problem with the iframe is i would need 3 for each entry and some of the content wont break the page but some can
Take a look PHP Code:
|
|
#11
|
|||
|
|||
|
found the problem, a real eggface moment
i se height to 300 not 300px the px fixed it ![]() |
|
#12
|
|||
|
|||
|
Quote:
so i've been using the new divs a couple days now and saw something kind of anoying. Now if the copy is less then 300 px theirs a big white space. Is there a good way to only set the max div height is content is > 300? |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > php5 - Iframes and sqlcontent |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|