kuut
Posts: 8
|
| Posted: 09/25/2008, 6:11 AM |
|
i'm not a experienced web developer. i was hired by a company that uses codecharge, and was told since i know html really well i should have no problems....which has turned out to not be the case.
either way i appreciate any help the more experienced developers can give.
i have managed to figure out how to create dynamic SEF URLs by changing certain things in the html and htaccess files. urls that look like: www.mywebsite.com/content/Keyword Phrase here/
however, while that works, it's been brought to my attention that instead of spaces in the url there needs to be dashes, so search bots will read them better. like: www.mywebsite.com/content/Keyword-Phrase-here/
If "Keyword Phrase here" is data in a field that has been entered and is being passed to the URL by a link that displays "Keyword Phrase here", how can i, with codecharge, replace those spaces with dashes? i know there's replace commands in php, but how would i go about doing that in CCS? create a label and make it equal to something.....or maybe make an event for the link that's passing the text field? i'm really not sure.
thanks for any help you can provide
|
 |
 |
DonP
|
| Posted: 09/25/2008, 8:48 AM |
|
That's right, it is improper for any file name or URL to have spaces in
it whether it's an HTML file, an image name or a script. Some browsers
replace the space with a %20 while others simply give a "page not found"
error when they come to the first space and think that's the end of the
name. (I prefer underscores to dashes.)
In your case, it's not a CodeCharge Studio question but rather a PHP
one. I'm going from memory here but you'll probably need to add a
BeforeShow event to the label or link, and add the PHP urlencode()
function (see www.php.net for details), something like:
$GridName->LabelName->SetValue(urlencode($GridName->LabelName->GetValue()));
I'm heading out of town shortly so if I don't have this quite right,
someone else is free to jump in and take over!
I am having the opposite problem as you, being well-versed in CCS to the
point that I've forgotten "real" PHP and other programming! I need a job
like yours where CCS is used.
Don (DonP)
kuut wrote:
> i'm not a experienced web developer. i was hired by a company that uses
> codecharge, and was told since i know html really well i should have no
> problems....which has turned out to not be the case.
>
> either way i appreciate any help the more experienced developers can give.
>
> i have managed to figure out how to create dynamic SEF URLs by changing certain
> things in the html and htaccess files. urls that look like:
> www.mywebsite.com/content/Keyword Phrase here/
>
> however, while that works, it's been brought to my attention that instead of
> spaces in the url there needs to be dashes, so search bots will read them
> better. like: www.mywebsite.com/content/Keyword-Phrase-here/
>
> If "Keyword Phrase here" is data in a field that has been entered and is being
> passed to the URL by a link that displays "Keyword Phrase here", how can i, with
> codecharge, replace those spaces with dashes? i know there's replace commands
> in php, but how would i go about doing that in CCS? create a label and make it
> equal to something.....or maybe make an event for the link that's passing the
> text field? i'm really not sure.
> thanks for any help you can provide
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>
|
|
|
 |
datadoit
|
| Posted: 09/25/2008, 6:58 PM |
|
In your form field's OnValidate event, add Custom Code:
$Component->SetValue(str_replace(" ","-",$Component->GetValue());
There's also a way to handle this with Apache's mod_rewrite, but I don't
know how. Google it... should be quite common.
|
|
|
 |
kuut
Posts: 8
|
| Posted: 10/21/2008, 11:51 AM |
|
this works for a before show event
$gridname->pieceInGrid->SetValue(urlencode($gridname->pieceInGrid->GetValue()));
|
 |
 |
kuut
Posts: 8
|
| Posted: 10/21/2008, 12:17 PM |
|
oops forgot also:
$GridName->pieceInGrid->SetValue(str_replace(" ","-",$GridName->pieceInGrid->GetValue()));
works perfect in the BeforeShow of the pieceInGrid, not the entire grid.
this'll change it to a dash
|
 |
 |
Wake
Posts: 6
|
| Posted: 03/27/2009, 7:09 AM |
|
Here is a description how one could build-in seo-friendly URLs into CCS: http://forums.yessoftware.com/posts.php?post_id=105330
_________________
Notes on CCS, Joomla, etc.
http://php-builder.org |
 |
 |
|