close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

URLS not passing properly

Thread began 9/12/2014 12:55 am by Christopher West | Last modified 9/12/2014 2:09 pm by Jason Byrnes | 1268 views | 7 replies |

Christopher WestCommunity Expert

URLS not passing properly

Hi. Ok hopefully this will make sense while I figure out how to describe my issue.

Im using User Friendly SEOS via HTACCESS (Which works)

here is the code:

Options +FollowSymlinks
Options -Multiviews
RewriteRule ^Category/([^/.]+)/?$ /category.php?Categories=$1 [NC]
RewriteRule ^Product/([^/.]+)/?$ /product.php?Product=$1 [NC]
RewriteRule ^Article/([^/.]+)/?$ /dinky-article.php?Article=$1 [NC]



Therefore my URL is now:

http://www.dinkyfingerprintjewellery.co.uk/Category/Individual-Charm

if you look at this URL on th eright hand side under a set of links there should be some additional content displaying:

SIDE NOTE: If you look at this URL: http://www.dinkyfingerprintjewellery.co.uk/ordering.php you will see what content I mean (So I know it works in part since the right hand side content displays on this page)...it just doesnt display on any of my category pages

in the database the this additional content is selected via a field named "FeaturedLocale" - so for example for all my category pages (since im using HTACCESS to re-write the URLS the FeaturedLocale contains:
/Category/Individual-Charm
Category/Bracelets
Category/Cufflinks

SIDENOTE: my other pages (NOT User Friendly URLS) contain for example:
ordering.php
frequently-asked-questions.php
caring-for-your-silver.php

So those work,


Here is my RecordSet to display this content:

php:
$basefile = basename ( $_SERVER["REQUEST_URI"] );


mysql_select_db($database_dinkydb, $dinkydb);
$query_rsFeatured = "SELECT * FROM featured LEFT OUTER JOIN products ON featured.FeaturedTypeID = products.ProductID WHERE FeaturedType = 1 AND FeaturedLocale = '$basefile'";
$rsFeatured = mysql_query($query_rsFeatured, $dinkydb) or die(mysql_error());
$row_rsFeatured = mysql_fetch_assoc($rsFeatured);
$totalRows_rsFeatured = mysql_num_rows($rsFeatured);



and the PHP to display the content:

php:
<?php if ($totalRows_rsFeatured 0) { // Show if recordset not empty ?>

  <div class="clearfix"></div>
  <div class="hide-mobile-bottom hide-mobile-side">
  <div class="feature-heading">Featured Products</div>
  <?php do { ?>
    <p class="feature-name"><a href="../Product/<?php echo $row_rsFeatured['ProductLink']; ?>"><?php echo $row_rsFeatured['ProductName']; ?></a></p>
    <div class="clearfix"></div>
    <p class="feature-price">From  £<?php echo $row_rsFeatured['ProductPrice']; ?></p>
    <p class="feature-image"><a href="../
    Product/<?php echo $row_rsFeatured['ProductLink']; ?>"><img  src="../images/products/large/<?php echo $row_rsFeatured['ProductImage']; ?>" width="250" alt="<?php echo $row_rsFeatured['ProductImageTitle']; ?>"/></a></p>
    <?php } while ($row_rsFeatured mysql_fetch_assoc($rsFeatured)); ?>
 </div>
  <?php // Show if recordset not empty ?>



I just dont know what im doing wrong, well obviously it has to do with the HTACCESS User friendly URLS but how can I reference them when I need to store the page location in the database.

Im attaching a screenshot of the database records:



Chris

Sign in to reply to this post

Jason ByrnesWebAssist

to troubleshoot, write the recordset SQL to the screen:

<?php echo($query_rsFeatured); ?>

this will help you see what SQL is being used at run time

Sign in to reply to this post

Christopher WestCommunity Expert

Hi, I tried this before, here is the result:
SELECT * FROM featured LEFT OUTER JOIN products ON featured.FeaturedTypeID = products.ProductID WHERE FeaturedType = 1 AND FeaturedLocale = 'Individual-Charm'

I just dont know what to do know.

Sign in to reply to this post

Jason ByrnesWebAssist

well, i dont see any records where the featured local is = to Individual-Charm.

i see:
/Category/Individual-Charm


you could change the recordset so it uses Ends with:

SELECT * FROM featured LEFT OUTER JOIN products ON featured.FeaturedTypeID = products.ProductID WHERE FeaturedType = 1 AND FeaturedLocale LIKE '%Individual-Charm'

Sign in to reply to this post

Christopher WestCommunity Expert

Hi Jason, the LIKE tweak to the recordset works! :)

Side Note: from your suggestion of writing out the recordset, showed that the recordset was checking for "Individual-Charm" ... and the URL ended with: /Category/Individual-Charm ...So they way I looked at that I needed to somehow append /Category/ to the basefile statement (which currently is $basefile = basename ( $_SERVER["REQUEST_URI"] );) However I thought if I did that append then other pages (that was NOT User friendly URLS wouldnt work...ie frequently-asked-questions.php). So even though I got it to work using LIKE.... what could have been a solution to append /Category/ to the basefile variable in my recordset?

Chris

Sign in to reply to this post

Jason ByrnesWebAssist

perhaps instead of using
$_SERVER["REQUEST_URI"]

try using
$_SERVER["PHP_SELF"]

Sign in to reply to this post

Christopher WestCommunity Expert

That makes more sense, so I was probably using the wrong $_SERVER code. I will probably try that later to check just for piece of mind...but in the mean time your earlier solution works perfectly, So once again thank you Jason for helping me with this so quickly :)

Chris

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...