Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Mike101

Members
  • Joined

  • Last visited

  1. Well I'm looking into editing the data before it gets entered now anyway, either way something like trim, htmlentities, strip_tags will help there or some str_replace. But they are trusted sources. I'm still figuring it all out and its far from done.
  2. The parser is a seperate app that access to the web to ping defined sources added by myself to get the info for the db, and the site that access the db only has read functions.
  3. I thought it'd be easier to edit it by leaving all the tags intact (slightly bigger db but I could live with that), but I'll have a look at my parser script to see if it'd be better to edit from the other end before it even gets entered. Thanks for the input.
  4. It's automaticaly grabbed by a parser, but either way I'd still have the same problem, removing the stuff I dont want parsed/removing the stuff I dont want to output.
  5. It's things like links and adverts, so I need to remove the whole thing. eg in: <div style="background-color: #eee"> <p>Bla bla bla text1 bla bla bla</p> <div style="background-color: #"> <a href="http://www.test.com/test/test.html">Bla bla bla text2 bla bla bla</a> Bla bla bla text3 bla bla bla </div> </div> I'd need to remove this part: <div style="background-color: #"> <a href="http://www.test.com/test/test.html">Bla bla bla text2 bla bla bla</a> Bla bla bla text3 bla bla bla </div> Simply by using text2 or text3 as an anchor. Actually the data in the $row I'm pulling from mysql would be formated in maybe 50 different ways, BUT I could know beforehand because I have a column numbering where it cam from, so I could make a preg_replace function with if statements, eg if format_id 15 do this and so on.. But I can't even get my head around the example above and why my code wont work. Any other ideas? Or just stick with it?
  6. Hey, sorry your right I should have been more specific. I'm pulling rows from a MySql database using php with a lot of junk at the bottom which I need to remove, trouble is its all formated differently, but they do have things in common: 1. Its html 2. Junk is always at the bottom 3. Words or phrases exist in the part I want to remove that do not exist in the part I want to keep So I thought preg_replace would be the best solution for this but I'm having trouble getting my head around regular expressions (I'm getting there though, I know more that I did last week!), unless someone can think of a better idea?
  7. Can anyone tell me why on the following code: <div style="background-color: #eee"> <p>Bla bla bla text1 bla bla bla</p> <div style="background-color: #"> <a href="http://www.test.com/test/test.html">Bla bla bla text2 bla bla bla</a> Bla bla bla text3 bla bla bla </div> </div> "#<a.*text2.*/a>#i" Works to remove the link with empty code in preg_replace, but the following both do nothing. "#<div.*text3.*/div>#i" "#<div.*<a.*a>.*text3.*/div>#i" Tryed with differnet modifiers /s and /m. Just can't see what I'm doing wrong.
  8. Yea I've been reading stuff like that all week.
  9. Ok I've sort of got it working, but only to remove the string the keyword is on: $string = preg_replace("/<(a|div|b|p)[^>]*>(.*)(wordtosearchfor|orthisone)(.*)<\/(a|div|b|p)>/iU", '',$string);
  10. I need to remove all the code after a certain word or phrase shows up in a string, including the string it was found in, possibly within the tag itself or between tags AND it could show up in multiple different tags like <p> <b>... Would preg_replace be best for this? To find it and just replace everything after and including it with empty code "". eg.. Say the word shows up in a <a href..etc tag, or between <p> and </p>, I dont want any of that code or any other code after it to display. I'm terrible at regex so if anyone could help me here or point me in the right direction that would be great.
  11. It's was just a working version to test it. I've got a redirect incase someone enters the page directly, and amongst other things, I'm trimming the $_GET['id'] with: $id = trim(htmlentities(strip_tags($id)));
  12. I managed to fix the $id problem, just needed to add $_GET['id']; to get it from the header.. Thanks for your help.
  13. Yea ^ doesn't work because of the $id bit, I'll look into this; tonight when I get more time. Thanks.
  14. I think this may work. Can you see any problems with this? <?php // Connect to db mysql_connect("host", "user", "pass"); mysql_select_db("db_name"); // Add 1 to the click field for the link mysql_query("UPDATE table_name SET clicks = clicks + 1 WHERE ID = $id"); // And then get the link $data = mysql_query("SELECT * FROM link WHERE ID = $id"); $info = mysql_fetch_array($data); // Redirect to the link the user clicked header( "Location:" .$info['URL'] ); ?> The link will look something like this: <a href="http://www.mysite.com/out.php?id=1www.fake.com/fake">www.fake.com/fake</a> I was going to tackle the jquery click listener later.
  15. Thanks for your help, but I cant realy see how that article would help here.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.