|
Feeds
- Downloads
- FAQ
- News
- Tutorials
|
|
|
View previous topic :: View next topic |
Author |
Message |
Guardian webmaster
Joined: Dec 25, 2005 Posts: 364 Location: Vsetin, Czech Republic
|
Posted: Mon Dec 05, 2011 6:23 am Post subject: nukeSEO(dh) extending |
|
|
Just getting around to looking at how to extend the base class and I have a question regarding overriding the meta keywords.
So far I think I have done everything correctly;
Created a class extender using the existing naming convention i.e. for my module CA_Jobs I create
includes/nukeSEO/dh/dh_CA_Jobs.php
Within this file I have Code:
class dhCA_jobs extends dhclass {
function dhCA_Jobs () {
$this->content_id = 'pk';
$this->content_table = 'ca_job';
$this->contentTitleArray = array('title','fk_city', 'fk_country');
$this->contentDescArray = array('description','salary','currency');
$this->contentKeysArray = array('title','description','fk_city');
$this->cat_id = 'pk';
$this->cat_table = 'ca_job_category';
$this->catTitleArray = array('name');
$this->catDescArray = array('name');
$this->catKeysArray = array('name');
// If pending content is stored in the same table, inactive content, private content, etc.
$this->activeWhere = '';
}
function getContentID() {
global $pk;
return $pk;
}
function setContentID() {
global $pk, $dhID;
$pk = $dhID;
}
function getCatID() {
global $pk;
return $pk;
}
function setCatID() {
global $pk, $dhCat;
$pk = $dhCat;
}
}
|
This produces my expected results in the nukeSEOdh block that is visible to admins and shows me the following;
TITLE: Teacher required Mragowo Poland - Code Authors
DESCRIPTION: Awesome teacher required 22,000 GBP
KEYWORDS: see below
So, to my questions...
1 - how can I remove 'Code-Authors' from the TITLE (without using the manual override functions in the nukeSEO(dh) block.
2 - Why are the KEYWORDS still showing the site defaults? I assumed this was overridden with what is assigned in the contenKeysArray i.e. in the code above, it should use title,description. |
|
Back to top |
|
|
Guardian
|
Posted: Mon Dec 05, 2011 12:38 pm Post subject: |
|
|
Pretty sure I'm missing a key piece of the puzzle here. This is my surrent code Code:
class dhCA_Jobs extends dhclass {
function dhCA_Jobs() {
global $prefix;
$this->content_id = 'pk';
$this->content_table = 'ca_job';
$this->contentTitleArray = array('title', 'fk_city', 'fk_country');
$this->contentDescArray = array('description', 'salary', 'currency');
$this->contentKeysArray = array('fk_continent', 'title', 'description');
// If pending content is stored in the same table, inactive content, private content, etc.
$this->activeWhere = 'active=1';
}
function getContentID() {
global $pk;
return $pk;
}
function setContentID() {
global $pk, $dhID;
$pk = $dhID;
}
}
|
Just in case it helps;
pk is a primary key (int)
all the other DB fields are TEXT
I'm able to switch them all around within the contentTitleArray and contentDescriptionAttay and the nukeSEO (dh) side block updates to reflect my changes as does the page source code but no matter what I put in contentKeysArray the keywords remain the same as the site defaults.
Am I incorrectly assuming contentKeysArray is for keywords? |
|
Back to top |
|
|
kguske Site Admin
Joined: May 12, 2005 Posts: 876
|
Posted: Mon Dec 05, 2011 12:42 pm Post subject: |
|
|
I'll have to take a look at this when I have more available brain cycles... _________________ |
|
Back to top |
|
|
Guardian
|
Posted: Mon Dec 05, 2011 1:12 pm Post subject: |
|
|
Sure, no problem.
I'm assuming I don't need to set any $vars on the module page being displayed on the basis that the data is being explicitly set in the class extender (and I cannot see where any of the other modules do this, with the exception of $pagetitle).
I'm also assuming that the nukeSEO (dh) model isn't looking for 'keys' in the page url i.e. id=x or cid=y that sort of thing.
All the fields are valid and within the same table.
I also tried following the example in dhDefault.php which implies by the sample code that you can use function getHEAD to force an override on all the meta data but that just generated a few errors for me.
In the mean time I'll keep tinkering with it as this is pretty much the last bits to complete before I can release the module. |
|
Back to top |
|
|
spasticdonkey webmaster
Joined: Oct 26, 2007 Posts: 69
|
Posted: Tue Dec 06, 2011 10:34 am Post subject: |
|
|
I think you might just need to add prefix to some of the code??
Code:$this->content_table = $prefix.'_ca_job';
$this->cat_table = $prefix.'_ca_job_category';
|
assuming your tables start with _
I've used something like this within my module when creating a dh file to help debug.
Code:if (is_admin($admin)){
$dhID = $dh->getContentID();
$dhCat = $dh->getCatID();
$dhSubCat = $dh->getSubCatID();
echo 'Category:'.$dhCat.' SubCategory:'.$dhSubCat.' Content:'.$dhID;
}
|
if you have 2 values greater than 0, or all values 0 when not on the module index, there is a problem |
|
Back to top |
|
|
Guardian
|
Posted: Tue Dec 06, 2011 11:47 am Post subject: |
|
|
I'm not actually using $prefix. The full table name is literally ca_job with no prefix or anything. However I see I have removed $prefix from some of the functions and not others so I'll add the missing ones back in, in case they are actually needed when processing the functions.
I'll add that debug code to my module, I had actually added something similar to within the main dh functions but it never hurts to have more
The module index page I had manually changed by using nukeSEO(dh) side block as it's no big deal to do so. The main problem is with an internal page of the module that displays a page containing the full details of the job.
The title and description are changing as expected depending on the job being displayed (jobDetail&pk=X where X is a numeric value) but the keywords remain constant and show the site defaults. Of course I could use the override but I couldn't expect users of the module to manually have to do that for ever job that was available as it could potentially be hundreds of jobs.
I actually played some more with this today by attempting to use the getHEAD function in the module index, internal module pages and also within the dh class extender file and couldn't get that to work as an override either. It does seem to do *something* as it null's the default meta data causing only the GENERATOR and CONTENT TYPE to be output to the browser. I'll play with it some more tomorrow as it might just need a global $var adding somewhere.
Alternatively I might have to release the module with a custom header file until I can figure out where I'm going wrong. |
|
Back to top |
|
|
kguske
|
Posted: Wed Dec 07, 2011 8:45 am Post subject: |
|
|
If I remember correctly, the keywords expect a minimum number of keywords (don't remember if it's a count of the number of words and / or the number of unique keywords). You might try using a description that contains 4 or 5 words several times. |
|
Back to top |
|
|
Guardian
|
|
Back to top |
|
|
Guardian
|
Posted: Wed Dec 07, 2011 10:29 am Post subject: |
|
|
OK thanks, that seems to have clarified the problem.
a - I was expecting to 'force' my own specific keywords and that isn't how it currently works.
b - I see now that it runs through the autokeywords class and there wasn't enough data for it to do it's job.
The output is still nowhere near as tight as I had hoped as I was hoping to force the specific keywords for it to use and also the order in which they were used but I now have it pretty close using something like Code:
$this->contentKeysArray = array('fk_city','fk_city','fk_country','fk_country','title','title','description');
|
This passes in duplicate keys so the autoseokeyword class can munch on it and it pretty much does the job - thanks once again for the insight! |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001-2008 phpBB Group
|
|
|