BradleyBrokers Posted November 26, 2007 Share Posted November 26, 2007 I am in the proccess of converting/updating the origonal existing webpage, www.BradleyBrokers.com/clients/htm, with php to do several new php functions and could use a little help. Here is the script I am having trouble writing. i.e. parsing errors: <?php $ListingCode = array("LincolnParkPPA","Rockfordbar","Bennigans","ChicagoCubs","OneMagMIleTavern","DriveThru","SoupChicago","Quiznosgurnee","IndySportsBar","Burbanklive","Oakparkthree","Mocha","FoxRiverAndr","ItalianGeneva","Frankbistro","Alfredobar"); $FirstLine[0]="Chicago Tavern: $ 1,800,000 / Lincoln Park including real estate."; $FirstLine[1]="Sports Bar: $ 2,400,000 / Rockford, IL -- hotel district. Biz includes real estate."; $FirstLine[2]="Bennigan's (Existing): $ 850,000 / Outskirts of area / biz. only."; $FirstLine[3]="Fast-Serve Restaurant: $ 120,000/Addison & Clark ---VERY near Wrigley--"; $FirstLine[4]="Chicago Gold-Coast/River North Tavern: $ 650,000 / North of the Chicago River and East. River North - Magnificent Mile. VERY RARE OPPORTUNITY!"; $FirstLine[5]="Drive Thru Fast Food: $ 1,700,000 / Carol Stream. Real Estate and business."; $FirstLine[6]="Fast Serve: $ 799,000 / Niche fast-serve restaurants -- three locations included."; $FirstLine[7]="Quiznos: $ 274,999 / Exclusive Quiznos Franchise -- Gurnee IL--."; $FirstLine[8]="Sports Bar: $ 3,200,000 / Indianapolis-- Very nice cash flow with real estate included --."; $FirstLine[9]="Night Club: $ 2,500,000 / Burbank, night club with real estate."; $FirstLine[10]="Sandwich: $ 140,000 / Oakpark, Sandwich shop restaurant."; $FirstLine[11]="Cafe: $ 165,000 / Chicago North-side."; $FirstLine[12]="Restaurant $ 355,000 / St. Charles Restaurant located on the Fox River."; $FirstLine[13]="Italian Restaurant: $ 525,000 / Geneva (St. Charles/Batavia) Monopoly restaurant biz."; $FirstLine[14]="Upscale Bistro: $ 375,000 / Frankfort -- Historic location rare opportunity."; $FirstLine[15]="Tavern with Apartment: $ 650,000 / Chicago tavern business with real estate included."; $Text[0]="Two story. Bars located on each floor. Very rare Chicago PPA license included. Top-notch tavern near DePaul University. Bars for sale in this area are a rare find. 5,300 SF building on a standard 25x125 Chicago lot. Decked-out for high-volume."; $Text[1]="Look at these gross sales: $ 2,347,978, $ 2,739,545, $ 3,350,200. Food costs are 30%. Liquor license. Demographics include 1,500 hotel rooms in 2 block radius. Absent owner. Aprox. 9,000 SF free standing building with 90+ parking spaces! Sports bar with many plasma/projection tvs."; $Text[2]="Bennigan's Grill & Tavern is the market leading franchise often imitated, but never duplicated. The financials are great. This is a VERY rare opportunity. The owner never steps foot in the store. A new Bennigan's franchise cost between $ 1,555,075 - $ 3,559,675 (plus real estate). Prospects are required to demonstrate $ 3,000,000 net worth prior to disclosures."; $Text[3]="Owner will financance. Be neighbors with Raw Bar, Gingerman, Trace, Yak-zies, Tuscany, Full Shilling, Casey Moran's, and of course, The Chicago Cubs. This is an all cash business. Rent is $ 3,600 (plus $ 400 for taxes and mnt.) Fantastic location. 1250+ SF retail. All equipment stays."; $Text[4]="Chicago's most desired retail location. Be neighbors with the new Trump Condo-Hotel, Opra Windfry, The Water Tower, Loyola University, and the 10,000,000 pedestrians who walk through the area annually. No strikes on the license. Liquor only (no food). Approx 50' x 125' site 1st floor bar plus lower-level private bar and small apartment-all included. Rent is approx. $14,000(modified gross). Ready for music venue. All equipment stays. If you have to know the financials -- this is not the business for you! For those in the know, the door is open."; $Text[5]="Growing area with high traffic count. Free standing building, land, and fast-food franchise included with the sale. You may keep the existing franchise or put in your own concept. Lot is approx. 35,000 SF and building is approx. 2,000 SF. Seating for 40. All equipment stays. Home Depot, Aldi's, Value City, and many more big-boxes are in the area."; $Text[6]="No food preparation. Absent owner. All high quality Chicago locations. Owner's income after all expenses (including rent): $ 265,000."; $Text[7]="Goss income $ 430,000. Owner's income after all expenses: $ 115,000. Easy business to own. Owner pays manager out of owner's income to do ALL the work."; $Text[8]="Food costs @ 30%. Liquor license. Absentently owned by conglomerate. Aprox. 9,000 SF free standing building with aprox. 100 parking spaces! Sports bar with many plasma/projection tvs. In-cooperation with Len Givens, Broker Indiana."; $Text[9]="Fantastic tavern with live music. 10,000+ sf building and 30,000+ sf in real estate. Plenty of parking. Stage. Banquets. Smoking permitted. Own a very huge bar near the new Chicago Fire Stadium. Contigous real estate in this size is hard to find."; $Text[10]="Easy hours. Long term lease. Fantastic customer base. High quality food. Located on street with plenty of foot traffic. A very good value. "; $Text[11]="Owning this quaint cafe is a dream come true. Easy hours. Fantastic build-out. Low rent ($ 1,000 per month). Indoor/outdoor seating. Great pasteries and specialty foods."; $Text[12]="Customers have enjoyed for over twenty years of business the outstanding views of the Fox River. plenty of parking and an upscale bar area."; $Text[13]="Only restaurant in area with 7,000+ sf. Only restaurant in area for receptions, banquets, and luncheons. Long term lease, liquor, and superior build-out."; $Text[14]="Upscale bistro has been in business for many years. Just featured on television show for the elegant food. Liquor, food, and loyal customer base. Gross is about $ 600K. Long term lease or perhaps purchase building."; $Text[15]="North Noble Park area. Tavern on the first floor and apartment on the second floor in this mixed use brick building. Perfect for live-work or rent apartment for additional income. Four new construction buildings on the same block."; ?> <!-- ###################################################### # FUNCTION CODE # ###################################################### // --> <?php Function Display_Bradley_Listing() { global $FirstLine, $Text, $ListingCode; array_multisort ($ListingCode, $FirstLine, $Text); echo ("$FirstLine"); for ($i=0; $i; $i++) { echo ("$FirstLine[$i]<br><br><br>$Text[$i]"; echo "<br><br><br><br>"; echo "<div style="float:right; width:300px />","\n"; echo "<Form Action = 'BradleyBrokersMissing.php' method='POST'>"; echo "<input type='hidden' name='ListingCode' value='$ListingCode[$i]'>"; echo "<input type='submit' value='MORE INFORMATION'></form>\n")"; } <img src="picts/arrow.gif" HEIGHT=15 WIDTH=15 alt="image"><br><br></div> <div style="padding: 5px 0px 5px 15px; float:left; width:250px">"); return; } ?> <!-- ####################################################### # END FUNCTION CODE # ####################################################### // --> <CENTER> <!-- MAIN TABLE--> <TABLE cellpadding=0 cellspacing=10 border="0" width="450"> <tr><td ALIGN="LEFT" VALIGN="TOP"> <img src="picts/spacer.gif" HEIGHT=20 WIDTH=30><br> <!-- START CLIENT TEXT --> <div id="printReady"> <table align="center" width="550"> </div> <p> <span class="title">LISTINGS</span><BR> <br> Our clients enjoy 100% privacy and confidentiality. <br> Client listings are randomized and updated every day.<br> <a href="javascript:void(printSpecial())">Click Here For A Printable Version Of Listings</a> <br>_____________________________________________________________<br><br> <LI> <?php echo Display_Bradley_Listing(); <img src="picts/beer art.jpg" HEIGHT="150" WIDTH="220" /></div> ?> <br>_____________________________________________________________<br><br> <LI> <?php echo Display_Bradley_Listing(); <img src="picts/beer art.jpg" HEIGHT="150" WIDTH="220" /></div> ?> <img src="picts/clients.jpg" HEIGHT="150" WIDTH="220" /></div> </div><br> </p> <br style="page-break-before: always;" clear="all" /> <br>_____________________________________________________________<br><br> <LI> <?php echo Display_Bradley_Listing(); <img src="picts/beer art.jpg" HEIGHT="150" WIDTH="220" /></div> ?> <img src="picts/Bennigan's Grill & Tavern.jpg" HEIGHT="150" WIDTH="220" /></div> <br>_____________________________________________________________<br><br> <LI> <?php echo Display_Bradley_Listing(); <img src="picts/beer art.jpg" HEIGHT="150" WIDTH="220" /></div> ?> <img src="picts/Bradley pub burger.jpg" HEIGHT="150" WIDTH="220" /></div> </div><br> </p> <br style="page-break-before: always;" clear="all" /> <br>_____________________________________________________________<br><br> <LI> <?php echo Display_Bradley_Listing(); <img src="picts/beer art.jpg" HEIGHT="150" WIDTH="220" /></div> ?> <img src="picts/Tom Bradley chicago tavern.jpg" HEIGHT="150" WIDTH="220" /></div> <br>_____________________________________________________________<br><br> <!-- [color=green]################################################### It continues to repeat the remaining listings. Each of the 15 listings has three matching arrays: ListingCode, FirstLine, Text (1) The correct ListingCode is going to be automatically sent and filled into the (BradleyBrokersMissing.php) form. (2) I also want to randomize the Display_Bradley_Listings() once per day without messing-up the matching order of the three arrays. ######################################################[/color] --> Any Help??? mod edit - code tags added Quote Link to comment Share on other sites More sharing options...
BradleyBrokers Posted November 26, 2007 Author Share Posted November 26, 2007 If you need to see how it looks without php, Sometimes the site needs to be accessed as follows: http://www.bradleybrokers.com/clients.htm or www.BradleyBrokers.com <Listings> Thanks folks! Quote Link to comment Share on other sites More sharing options...
teng84 Posted November 26, 2007 Share Posted November 26, 2007 sad to say but seems like nobody dares to read your codes.. can you tell us how do you want us to help you? ... Quote Link to comment Share on other sites More sharing options...
BradleyBrokers Posted November 26, 2007 Author Share Posted November 26, 2007 Each of the 15 listings has three matching arrays: ListingCode, FirstLine, Text I want to: (1) Make sure the content order does not get fouled-up in the Funtion; (2) Make sure the correct ListingCode is going to be automatically sent and filled into the (BradleyBrokersMissing.php) form. (3) I also want to randomize the Display_Bradley_Listings() on the webpage once per day without messing-up the matching order of the three arrays. Thks Quote Link to comment Share on other sites More sharing options...
Barand Posted November 26, 2007 Share Posted November 26, 2007 I'd reorganise the arrays into a single 2D array to keep items in synch <?php $data = array ( array ( 'ListingCode' => "LincolnParkPPA", 'FirstLine' => "Chicago Tavern: $ 1,800,000 / Lincoln Park including real estate.", 'Text' => "Two story. Bars located on each floor. Very rare Chicago PPA license included. Top-notch tavern near DePaul University. Bars for sale in this area are a rare find. 5,300 SF building on a standard 25x125 Chicago lot. Decked-out for high-volume." ), array ( 'ListingCode' => "Rockfordbar", 'FirstLine' => "Sports Bar: $ 2,400,000 / Rockford, IL -- hotel district. Biz includes real estate.", 'Text' => "Look at these gross sales: $ 2,347,978, $ 2,739,545, $ 3,350,200. Food costs are 30%. Liquor license. Demographics include 1,500 hotel rooms in 2 block radius. Absent owner. Aprox. 9,000 SF free standing building with 90+ parking spaces! Sports bar with many plasma/projection tvs." ), array ( 'ListingCode' => "Bennigans", 'FirstLine' => "Bennigan's (Existing): $ 850,000 / Outskirts of area / biz. only.", 'Text' => "Bennigan's Grill & Tavern is the market leading franchise often imitated, but never duplicated. The financials are great. This is a VERY rare opportunity. The owner never steps foot in the store. A new Bennigan's franchise cost between $ 1,555,075 - $ 3,559,675 (plus real estate). Prospects are required to demonstrate $ 3,000,000 net worth prior to disclosures." ), // etc ); ?> Quote Link to comment Share on other sites More sharing options...
BradleyBrokers Posted December 2, 2007 Author Share Posted December 2, 2007 Thanks --much easier to view and understand! Now, how would the suggested two-dimentional-associative-array look if images were added: I want to add a path to images for each listing so that a rondom-image will display. I am not sure how to express this within the array. In other words, the url subdirectory path called, "hamburger," contains several images which will also be randomly-rotated. So, the entire listing will be randomly-rotated and the images within the listing will also be randomly-rotated: A-rotation-within-a-rotation is needed. <? php $data = array ( array ( 'ListingCode' => "LincolnParkPPA", 'FirstLine' => "Chicago Tavern: $ 1,800,000 / Lincoln Park including real estate.", 'Text' => "Two story. Bars located on each floor. Very rare Chicago PPA license included. Top-notch tavern near DePaul University. Bars for sale in this area are a rare find. 5,300 SF building on a standard 25x125 Chicago lot. Decked-out for high-volume.", 'Status' => "Available", 'Photo' => "http://BradleyBrokers.com/hamburger.php", ), array ( 'ListingCode' => "Rockfordbar", 'FirstLine' => "Sports Bar: $ 2,400,000 / Rockford, IL -- hotel district. Biz includes real estate.", 'Text' => "Look at these gross sales: $ 2,347,978, $ 2,739,545, $ 3,350,200. Food costs are 30%. Liquor license. Demographics include 1,500 hotel rooms in 2 block radius. Absent owner. Aprox. 9,000 SF free standing building with 90+ parking spaces! Sports bar with many plasma/projection tvs.", 'Status' => "Available", 'Photo' => "http://BradleyBrokers.com/tavern.php", ), array ( 'ListingCode' => "Bennigans", 'FirstLine' => "Bennigan's (Existing): $ 850,000 / Outskirts of area / biz. only.", 'Text' => "Bennigan's Grill & Tavern is the market leading franchise often imitated, but never duplicated. The financials are great. This is a VERY rare opportunity. The owner never steps foot in the store. A new Bennigan's franchise cost between $ 1,555,075 - $ 3,559,675 (plus real estate). Prospects are required to demonstrate $ 3,000,000 net worth prior to disclosures.", 'Status' => "Available", 'Photo' => "http://BradleyBrokers.com/bennigans.php", ), // etc... ); ?> Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 2, 2007 Share Posted December 2, 2007 The main reason to use php to make a dynamically generated web page is so that you don't need to edit the HTML file every time you update or change information. By putting your information into arrays in the php code, you have just shifted from editing a HTML file to editing a PHP file every time you update or change information. You have not gained anything by doing this. You need need to use a database to hold your information and leave the contents of the PHP file alone whenever you update or change information (separation of code and data.) Quote Link to comment Share on other sites More sharing options...
BradleyBrokers Posted December 2, 2007 Author Share Posted December 2, 2007 Thanks. You are largely correct. However, there are several advantages of PHP over HTML that I want to use on the existing website discussed in this querry. For example, "random-rotating" is a manual proccess in html and can be automated in php. A further example is the use of the arrays in other webpages and webforms within the website. In other words, for my use php will permit a flexibillity that is not avaible in html. Yet, the entering of new data remains largely the same in either php or html as far as I am concerned and your point is well understood. Quote Link to comment Share on other sites More sharing options...
Barand Posted December 2, 2007 Share Posted December 2, 2007 Yet, the entering of new data remains largely the same in either php or html and your point is well understood. I'd say these quotes contradict one another and the point was missed completely Quote Link to comment Share on other sites More sharing options...
BradleyBrokers Posted December 2, 2007 Author Share Posted December 2, 2007 Pie in my face! You are right. Nevertheless, I am seeking help with an array question relating to rotating certain text and images within listing groups in php script --call me a "freak" if you desire. In HTML the page looks like this: http://www.BradleyBrokers.com/clients.htm In PHP I hope to make the page more dynamic by rotating data text. Further, within the listings I hope to rotate the images. Either way, I will need to enter new listing data as it is needed and delete the old lsiting data as it is no longer needed. I am in complete agreement that the entering, updating, and deleing of listing data will be just as difficult with php as it is in the current html. You are correct. Please be gracious if I have misunderstood your assistance. For now, I am only focusing on the correct set-up script for the suggested multi-dimentional associative-array. Quote Link to comment Share on other sites More sharing options...
Barand Posted December 2, 2007 Share Posted December 2, 2007 You would only need to hold the folder path. A function such as glob() could be used to pull the image names and then use array_rand() to display a random one each time Quote Link to comment Share on other sites More sharing options...
BradleyBrokers Posted December 2, 2007 Author Share Posted December 2, 2007 Could it look like this and work? <?php $http://BradleyBrokers.com/hamburger.php = "hamburger/"; //Placed in the set-up $http://BradleyBrokers.com/tavern.php = "tavern/"; $http://BradleyBrokers.com/bennigans.php = "bennigans/"; ?> <img src=echo rand($http://BradleyBrokers.com/hamburger.php) ?> alt=""> //Placed at the display place. Quote Link to comment Share on other sites More sharing options...
Barand Posted December 2, 2007 Share Posted December 2, 2007 If you set up the array like this, with 'Photo' element holding the image folder path <?php $data = array ( array ( 'ListingCode' => "LincolnParkPPA", 'FirstLine' => "Chicago Tavern: $ 1,800,000 / Lincoln Park including real estate.", 'Text' => "Two story. Bars located on each floor. Very rare Chicago PPA license included. Top-notch tavern near DePaul University. Bars for sale in this area are a rare find. 5,300 SF building on a standard 25x125 Chicago lot. Decked-out for high-volume.", 'Status' => "Available", 'Photo ' => "/hamburger" ), array ( 'ListingCode' => "Rockfordbar", 'FirstLine' => "Sports Bar: $ 2,400,000 / Rockford, IL -- hotel district. Biz includes real estate.", 'Text' => "Look at these gross sales: $ 2,347,978, $ 2,739,545, $ 3,350,200. Food costs are 30%. Liquor license. Demographics include 1,500 hotel rooms in 2 block radius. Absent owner. Aprox. 9,000 SF free standing building with 90+ parking spaces! Sports bar with many plasma/projection tvs.", 'Status' => "Available", 'Photo' => "/tavern" ), array ( 'ListingCode' => "Bennigans", 'FirstLine' => "Bennigan's (Existing): $ 850,000 / Outskirts of area / biz. only.", 'Text' => "Bennigan's Grill & Tavern is the market leading franchise often imitated, but never duplicated. The financials are great. This is a VERY rare opportunity. The owner never steps foot in the store. A new Bennigan's franchise cost between $ 1,555,075 - $ 3,559,675 (plus real estate). Prospects are required to demonstrate $ 3,000,000 net worth prior to disclosures.", 'Status' => "Available", 'Photo' => "/bennigans" ), // etc... ); Then have a function to return a random image name from the selected path <?php function randomImage($path) { $pics = glob ($path.'/*.jpg'); return $pics[array_rand($pics)]; } To display the image <?php $path = $data[2]['Photo']; $image = randomImage ('$path'); echo "<img src='$image'>"; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.