CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Dynamically change Meta-tags

Print topic Send  topic

Author Message
sumpen30


Posts: 16
Posted: 11/03/2004, 1:25 AM

Hello there!!!
I was wodering if anyone knows how to change Meta-tags on the fly. I am currently running a site http://www.guldshoppen.se and I would like the title for example to change when the user transcends into the Categories page.

I would like the title to change to Guldshoppen.se | Ringar,
Guldshoppen.se | Örhängen, etc.

I would be grateful for any tips.

Cheers
_________________
Guldshoppen.se - Gold and Silver Jewlery
http://www.guldshoppen.se
A website entirely created by CCS
View profile  Send private message
peterr


Posts: 5971
Posted: 11/03/2004, 7:30 AM

Replace your Meta Tags or Title with a label, then populate it programmatically using the Before Show event.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Damian Hupfeld
Posted: 11/03/2004, 3:02 PM

I am doing this on a number of sites and it works very well.


"peterr" <peterr@forum.codecharge> wrote in message
news:54188f98167249@news.codecharge.com...
> Replace your Meta Tags or Title with a label, then populate it
> programmatically
> using the Before Show event.
> _________________
> Peter R.
> YesSoftware Support Representative
> http://support.codecharge.com
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

sumpen30


Posts: 16
Posted: 11/04/2004, 12:41 AM

Brilliant! Why did not I think of that.

Cheers
_________________
Guldshoppen.se - Gold and Silver Jewlery
http://www.guldshoppen.se
A website entirely created by CCS
View profile  Send private message
sumpen30


Posts: 16
Posted: 11/04/2004, 5:46 AM

Damian,

I a litte pressured for time. Would you mind sending me an example. I would be more than happy to share the code at www.guldshoppen.se

Cheers
_________________
Guldshoppen.se - Gold and Silver Jewlery
http://www.guldshoppen.se
A website entirely created by CCS
View profile  Send private message
viktor
Posted: 11/04/2004, 6:25 AM

I've tried to put a grid between <head> </head> or between <title></title> - but failed.

How can I do it?

Thanks
zeuch


Posts: 25
Posted: 11/04/2004, 7:26 AM

Hi all,
you can create an includable page with a grid formated for the meta tags and include that page in others pages between <head> </head>.

If this don't work you can make that includable page a static page. I'm sure this work.

Regards
_________________
Matheus Zeuch
View profile  Send private message
peterr


Posts: 5971
Posted: 11/04/2004, 12:59 PM

Hi,

Not sure if I understand the last couple messages correctly (are Grids related to Meta Tags) but it does look like a valid idea to use a Grid or Record form with just one cell that outputs the Meta Tags from some database field.

Viktor, please, it's very important that you provide details if you need help. You failed, I didn't fail, so what do we do? Don't you need to describe the problem? I don't understand what and how could fail when placing a grid betwen those tags.
Also - if your question is not directly related to the previous discussion then I would appreciate if you post your question as a new topic.

Thanks.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
viktor
Posted: 11/05/2004, 1:26 AM

Quote peterr:
Viktor, please, it's very important that you provide details if you need help. You failed, I didn't fail, so what do we do? Don't you need to describe the problem? I don't understand what and how could fail when placing a grid betwen those tags.
Also - if your question is not directly related to the previous discussion then I would appreciate if you post your question as a new topic.

Thanks.

my 1st attempt failure
============
I have created a label. - in BeforShow I've put SetValue referencing to another value to be used as title. All worked

After that - when moving the very label in html editor of CCS between <title></title> - nothing happens or rather error - referencing to non-existing blblbla

my 2nd attempt - successful
==========
I've created a grid with necessary labels taking values from db.
checked. all works. then in html editor moved the very grid between <title></title> - works!

and then - copy-paste rule. I've done the same to all other meta-tags...

so thank you all!
feha


Posts: 712
Posted: 11/06/2004, 1:47 AM

Tjäna sumpen

You can do it very easy check my sites HTML (Twmplate)
http://www.vision.to/new_cms/Common/index.html

Some values are set by using:
global $Tpl;
$Tpl->SetVar("meta_tags",$my_own_tags);

etc ...
_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message
sumpen30


Posts: 16
Posted: 11/14/2004, 3:40 PM

Thank you very much feha! I think I got. Now I just need time to implement it.

Cheers

Quote feha:
Tjäna sumpen

You can do it very easy check my sites HTML (Twmplate)
http://www.vision.to/new_cms/Common/index.html

Some values are set by using:
global $Tpl;
$Tpl->SetVar("meta_tags",$my_own_tags);

etc ...

_________________
Guldshoppen.se - Gold and Silver Jewlery
http://www.guldshoppen.se
A website entirely created by CCS
View profile  Send private message
sumpen30


Posts: 16
Posted: 11/14/2004, 7:00 PM

Here is my code for inserting Meta Tags in the Title Header

global $Categories;
$db2 = new clsDBguld();
global $Tpl;

// Set Title
$SQL = "select PTYPE_NAME "
."FROM prodtype "
."WHERE PTYPE_ID = "
. $db2->ToSQL(CCGetParam("PTYPE_ID"), ccsInteger);
$db2->query($SQL);
if ($db2->next_record()) {
$category = $db2->f("PTYPE_NAME");
}
$title = "Guldshoppen.se | Kategorier | " . $category;

$Tpl->SetVar("category",$title);
unset($db2);
_________________
Guldshoppen.se - Gold and Silver Jewlery
http://www.guldshoppen.se
A website entirely created by CCS
View profile  Send private message
SteveG

Posts: 56
Posted: 02/20/2005, 5:36 PM

I've got a slightly different twist on this problem; I've got my head tag section in an attached page, with a {Page_Title} label waiting for a value - which all works. my problem is that I'm trying to pass it a value from a component (grid beforeshow, for example); but that doesn't work. I've tried a few combinations from the suggestions in this post, but I think that by the time I try to $attachedpage->Page_Title->SetValue() the head section is already parsed, or something like that. Does anyone know how I can pass values from a component into an attached page with the head section in it?

Thanks in advance,

- Steve
View profile  Send private message
peterr


Posts: 5971
Posted: 02/20/2005, 7:42 PM

See above code that feha posted:
global $Tpl;
$Tpl->SetVar("meta_tags",$my_own_tags);

This should work regardless of where the code is executed.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
SteveG

Posts: 56
Posted: 02/20/2005, 7:55 PM

I've tried to play around with the Tpl settings, but can't figure out the right syntax:

$Subscriptions->Tpl->SetVar("Page_Title",'----- TEST -----');

... doesn't work. Can you help a little with the syntax? (Page ="Subscriptions", IncludePage="Community", Grid="Records", Label="Page_Title") ... I'd like to change the Page_Title from some event within the grid.

Thanks,

- Steve
View profile  Send private message
peterr


Posts: 5971
Posted: 02/20/2005, 9:21 PM

I can't test it right now, but try:
$Tpl->SetVar("Page_Title","TEST");
Assuming that your label name is Page_Title.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
SteveG

Posts: 56
Posted: 02/21/2005, 7:37 AM

That's one of the combinations that did *not* work:


//Records_BeforeShow @57-EA94EF21
function Records_BeforeShow()
{
$Records_BeforeShow = true;
//End Records_BeforeShow

//Custom Code @404-932D69AD
// -------------------------
global $Tpl;
$Tpl->SetVar("Page_Title",'----- TEST -----');

// -------------------------
//End Custom Code

//Close Records_BeforeShow @57-4DA27934
return $Records_BeforeShow;
}
//End Close Records_BeforeShow


... It doesn't generate any errors, but the page title is not changed by the tpl call. I'm wondering if because the header section is located in an included page, and my event takes place within a component, if it's already been generated? Any other suggestions?

- Steve
View profile  Send private message
Martin K.
Posted: 02/21/2005, 11:58 PM

Hello.
I make a Grid in the Head from the HTML Template.
Put the Grid between the head Tags and make one Lable Field (HTML) in the Grid. This Lable Field can show your Metatags. You can add all your Metatags to a db Field and let the LableField shown this.
Your Title, IndexFollow, Keywords ....
So you can select the Metatags in the Where from the Grid for each Side.
Change Metatags for each lang, or for every categorie and so on. Its easy.

Sorry about my english
greets martin
Damian Hupfeld
Posted: 02/22/2005, 3:29 AM

Yep - my suggestion doesnt work so well with include pages... so you can
pass another variable (m in the example below) in your links:

http://www.mydomain.com/pages.php?id=45&m=45
http://www.mydomain.com/catalogue.php?cat=3&m=13

then use the m= to modify your include header content....

Messier? Yes. Does it work? Yes.

Damian
http://www.nexthost.com.au/services.php



"SteveG" <SteveG@forum.codecharge> wrote in message
news:542193b1a1b6a0@news.codecharge.com...
> I've got a slightly different twist on this problem; I've got my head tag
> section in an attached page, with a {Page_Title} label waiting for a
> value -
> which all works. my problem is that I'm trying to pass it a value from a
> component (grid beforeshow, for example); but that doesn't work. I've
> tried a
> few combinations from the suggestions in this post, but I think that by
> the
> time I try to $attachedpage->Page_Title->SetValue() the head section is
> already
> parsed, or something like that. Does anyone know how I can pass values
> from a
> component into an attached page with the head section in it?
>
> Thanks in advance,
>
> - Steve
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>


Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.