Typoscript: Override data with typolink - overriding

I'm trying to set the canonical url of page. If the individual field (tx_metaseo_canonicalurl) is not set then the url page should be determined by a typolink.
I tried this but it's not working:
30 = TEXT
30 {
data = FIELD:tx_metaseo_canonicalurl
override.typolink = {
parameter.data = TSFE:id
returnLast = url
forceAbsoluteUrl = 1
addQueryString = 1
addQueryString.method = GET
addQueryString.exclude = cHash,backPid
}
override.if.isFalse.field = tx_metaseo_canonicalurl
wrap = <link rel="canonical" href="|" />
required = 1
}

The last 3 lines should be inside the 30 cObj

Related

TYPO3 show content from subpages inlcuding css classes

With the following typoscript I get all content from the subpages on one page:
lib.allPid = COA
lib.allPid {
10 = HMENU
10 {
special = directory
special.value = 2
1 = TMENU
1 {
expAll = 1
NO.doNotShowLink = 1
NO.allStdWrap.field = uid
NO.allStdWrap.wrap = |,
}
2 < .1
}
}
lib.allContent = CONTENT
lib.allContent {
table = tt_content
select {
pidInList.cObject < lib.allPid
leftjoin = pages ON (tt_content.pid = pages.uid)
where = tt_content.colPos = 0
orderBy = pages.sorting ASC
}
}
But its not copying the tt_content wrap defined by the layout selectbox in the content element:
tt_content.stdWrap.innerWrap.cObject.default.20.40 = CASE
tt_content.stdWrap.innerWrap.cObject.default.20.40 {
key.field = layout
1 = TEXT
1.value = tag-1
2 = TEXT
2.value = tag-2
3 = TEXT
3.value = tag-3
4 = TEXT
4.value = tag-4
5 = TEXT
5.value = tag-5
6 = TEXT
6.value = tag-6
7 = TEXT
7.value = tag-7
}
I tried to add the wrap to the lib.allContent element like this, but it didn't work:
lib.allContent.stdWrap.innerWrap.cObject.default.20.40 = CASE
lib.allContent.stdWrap.innerWrap.cObject.default.20.40 {
key.field = layout
1 = TEXT
1.value = tag-1
2 = TEXT
2.value = tag-2
3 = TEXT
3.value = tag-3
4 = TEXT
4.value = tag-4
5 = TEXT
5.value = tag-5
6 = TEXT
6.value = tag-6
7 = TEXT
7.value = tag-7
}
Does anybody know how to do this? Thanks in advance!
EDIT:
I found a solution (or better: workaround) without typoscript. I insert the contents from the subpages with "New content element - Special Elements - Insert Record" manually one by one. Then, everything is copied. This solutions requires a little more user input but fits perfectly to my needs.
give a try to vhs ViewHelper it'll give you exact output what you want I mean default wrap and at all.
{namespace v=FluidTYPO3\Vhs\ViewHelpers}
<v:page.menu pageUid="2" includeSpacers="0" resolveExclude="1">
<f:for each="{menu}" as="contentList" iteration="Iteration">
<div id="uid{contentList.uid}" class="inner-page-content-of-pageUid-2">
<v:content.render column="0" pageUid="{contentList.uid}" />
</div>
</f:for>
</v:page.menu>
something more about vhs ViewHelper

web2py SQLFORM.grid url

When I try to put form = SQLFORM.grid(db.mytable) in my controller the request changes to my/web/site/view?_signature=520af19b1095db04dda2f1b6cbea3a03c3551e13 which causes my if statement in controller to collapse. Can smbd please explain why this happens?
If I put user_signature=False then on view load the grid is shown (though the looks is awful, and I still need to find out how to change the view of my table), but on search,edit, etc. click, the same thing happens again. The url is changed and I get an error
Any suggestions?
thank you
EDIT
This is my edit function
#auth.requires_login()
def edit():
#Load workers
workers = db(db.worker.w_organisation == 10).select(db.worker.w_id_w, db.worker.w_organisation, db.worker.w_first_name, db.worker.w_last_name,db.worker.w_nick_name,db.worker.w_email,db.worker.w_status,db.worker.w_note).as_list()
#Define the query object. Here we are pulling all contacts having date of birth less than 18 Nov 1990
query = ((db.worker.w_organisation == 10) & (db.worker.w_status==db.status.s_id_s))
#Define the fields to show on grid. Note: (you need to specify id field in fields section in 1.99.2
fields = (db.worker.w_first_name, db.worker.w_last_name,db.worker.w_nick_name,db.worker.w_email,db.status.s_code,db.worker.w_note)
#Define headers as tuples/dictionaries
headers = { 'worker.w_first_name' : 'Ime',
'worker.w_last_name' : 'Priimek',
'worker.w_nick_name' : 'Vzdevek',
'worker.w_email' : 'E-posta',
'status.s_code': 'Status',
'worker.w_note' : 'Komentar' }
#Let's specify a default sort order on date_of_birth column in grid
default_sort_order=[db.worker.w_last_name]
#Creating the grid object
form = SQLFORM.grid(query=query, fields=fields, headers=headers,searchable=True, orderby=default_sort_order,create=True, \
deletable=True, editable=True, maxtextlength=64, paginate=25,user_signature=False
)
form = SQLFORM.grid(db.worker,user_signature=False)
workersDb = db((db.worker.w_organisation == 10) & (db.worker.w_status==db.status.s_id_s)).select(db.worker.w_id_w, \
db.worker.w_organisation, db.worker.w_first_name, \
db.worker.w_last_name,db.worker.w_nick_name,db.worker.w_email,\
db.status.s_code,db.worker.w_note).as_list()
workersList = []
for rec in workersDb:
status = rec['status']['s_code']
workers = rec['worker']
if not rec["worker"]["w_first_name"]:
polno_ime = rec["worker"]["w_last_name"]
elif not rec["worker"]["w_last_name"]:
polno_ime = rec["worker"]["w_first_name"]
else:
polno_ime = rec["worker"]["w_first_name"] + " " + rec["worker"]["w_last_name"]
rec["worker"]['w_full_name'] = polno_ime
rec["worker"]["w_status"] = status
data = rec["worker"]
#print rec
#print data
workersList.append(rec["worker"])
# If type of arg is int, we know that user wants to edit a script with an id of the argument
if(request.args[0].isdigit()):
script = db(getDbScript(request.args[0])).select(db.script.sc_lls, db.script.sc_name, db.script.id, db.script.sc_menu_data).first()
formData = str(script["sc_menu_data"])
#form = SQLFORM.grid(db.auth_user)
#print formData
# If we dont get any results that means that user is not giving proper request and we show him error
#print script
#Parsing script to be inserted into view
if not script:
return error(0)
return dict(newScript = False, script = script, formData = formData, workers = workersList, form = form)
# If the argument is new we prepare page for new script
elif request.args[0] == 'new':
scripts = db((auth.user.organization == db.script.sc_organization)).select(db.script.sc_name, db.script.id, workers = workersList, form = form)
return dict(newScript = True, scripts = scripts, workers = workersList, form = form)
# Else error
else:
return error(0)
also not to mention the sqlgrid looks awful, here is link to the picture https://plus.google.com/103827646559093653557/posts/Bci4PCG4BQQ

EXT:tt_news <link> in RSS feed

I'm trying to set up an RSS Feed through tt_news in TYPO3: http://www.familieistzukunft.ch/home/?type=100
The links in the RSS feed are not proper HTML. They turn up like this:
<link http://www.familieistzukunft.ch/details/...80780691f/ - external-link-new-window "Opens external link in new window">Kommentar</link>
I did the template like this:
<content:encoded> <![CDATA[###NEWS_CONTENT###]]> </content:encoded>
So why does the CDATA tag not help? How do I fix this?
This is my TypoScript:
# RSS2
rss2 = PAGE
rss2 {
typeNum = 100
10 >
10 < plugin.tt_news
10.pid_list >
10.pid_list = {$plugin.tt_news.pid_list}
10.singlePid = {$plugin.tt_news.singlePid}
10.defaultCode = XML
10.displayXML.xmlFormat = rss2
#wenn man archivierte News nicht mehr RSSen will
10.archive = -1
config {
disableAllHeaderCode = 1
additionalHeaders = Content-type:text/xml
no_cache = 1
xhtml_cleaning = 0
}
}
#RSS 0.91
rss091 = PAGE
rss091 < rss2
rss091 {
typeNum = 101
10.displayXML.xmlFormat = rss091
}
#RDF
rdffeed = PAGE
rdffeed < rss2
rdffeed {
typeNum = 102
10.displayXML.xmlFormat = rdf
#RDF kennt auch Feed-Images
10.displayXML.xmlIcon = fileadmin/images/rdf.gif
}
#Atom
atom1 = PAGE
atom1 < rss2
atom1 {
typeNum = 103
10.displayXML.xmlFormat = atom1
}
page.headerData.110 = HTML
page.headerData.110.value = <link rel="alternate" type="application/rss+xml" title="News" href="http://www.familieistzukunft.ch/index.php?id=32&type=100">
I had the same problem and solved it with the following code:
rss.10.displayXML {
xmlFormat = rss2
content_stdWrap {
stripHtml = 0
htmlSpecialChars = 0
parseFunc < lib.parseFunc_RTE
parseFunc.nonTypoTagStdWrap.encapsLines.nonWrappedTag >
}
}
The idea is the same but use content_stdWrap instead of bodytext_stdWrap. In my case I got problem using htmlSpecialChars.preserveEntities = 1.
It looks, like you are just putting raw content from DB to ###NEWS_CONTENT### marker.
You should use pi_RTEcssText($rawContent); from tslib_pibase class to convert all the raw content to proper HTML.

Accessing SQL output in coding

I have a SQL output like
TotalLeave Status
---------- ------
3 PaidLeave
5 MedicalLave
and I need to show this value in my label controls like,
lblMedicalLeave.text = 5
lblPaidLeave.text = 3
for this I just created objects for my dataset in my code like,
StaffAttendanceStatusTableAdapters.StaffTypesTableAdapter staffAttendanceStatus =
new StaffAttendanceStatusTableAdapters.StaffTypesTableAdapter();
StaffAttendanceStatus.StaffTypesDataTable StaffDataTable =
staffAttendanceStatus.GetDataStaffAttendanceStatus(staff.StaffId);
if (StaffDataTable[0] != null)
{
StaffAttendanceStatus.StaffTypesRow StaffRow = StaffDataTable[0];
lblTotalMedicalLeave.Text = StaffRow.TotalLeave.ToString();
lblTotalPaidLeave.Text = StaffRow.TotalLeave.ToString();
}
its showing the same value(3), is it possible to get the TotalLeave value for corresponding Status? can anyone help me here
You are accessing the same row both times. Use StaffDataTable[1] to access the second row. Anyway you should check if there is a result before access any values!
using StaffAttendanceStatusTableAdapters;
....
StaffTypesTableAdapter staffAttendanceStatus = new StaffTypesTableAdapter();
StaffAttendanceStatus.StaffTypesDataTable StaffDataTable =
staffAttendanceStatus.GetDataStaffAttendanceStatus(staff.StaffId);
if (StaffDataTable != null && StaffDataTable.Count > 1)
{
lblTotalMedicalLeave.Text = StaffDataTable[0].TotalLeave.ToString();
lblTotalPaidLeave.Text = StaffDataTable[1].TotalLeave.ToString();
}
hth
Since you need to get TotalLeave from two rows, you need to fetch data from two rows.
if (StaffDataTable != null && StaffDataTable.Rows.Count > 1)
{
StaffAttendanceStatus.StaffTypesRow StaffRow1 = StaffDataTable[0];
StaffAttendanceStatus.StaffTypesRow StaffRow2 = StaffDataTable[1];
lblTotalMedicalLeave.Text = StaffRow1.TotalLeave.ToString();
lblTotalPaidLeave.Text = StaffRow2.TotalLeave.ToString();
}
if there is no order of PaidLeave and MedicalLave status, just check row.Status and assign total value to corresponding label

Drupal Theming: Omega drupal .info file?

I'm using an Omega child theme. I've renamed and renamed all the functions. I'm a bit of a newbie at drupal but a very experienced wordpress user. I'm a bit frustrated by the theme configurations.
I'm trying to use the .info file to override the columns and the layout. Whenever i change the number of columns it doesn't actually render the columns. I've cleared the cache as well. Unfortunately, the settings i've set in the Administration-> Theme -> Theme Configurations Page Override my .info file.
Any ideas?
The following is my .info file for my theme
; $Id: childtheme.info,v 1.1.2.15
; ------- Declare default theme information
name = Child Theme
description = Child Theme built by Globe Runner SEO
screenshot = screenshot.png
core = 6.x
base theme = omega
; ------- Declare default stylesheets
stylesheets[all][] = assets/css/common.css
stylesheets[all][] = assets/css/custom.css
; ------- Declare default javascript includes
scripts[] = assets/js/core.js
; ------- Declare default theme regions
regions[sidebar_first] = sidebar first
regions[sidebar_last] = sidebar last
regions[header_nav] = header nav
;regions[header_last] = header last
regions[preface_first] = preface first
regions[preface_middle] = preface middle
regions[preface_last] = preface last
regions[content_top] = content top
regions[content_bottom] = content bottom
regions[postscript_one] = postscript 1
regions[postscript_two] = postscript 2
regions[postscript_three] = postscript 3
regions[postscript_four] = postscript 4
regions[footer_first] = footer first
regions[footer_last] = footer last
regions[meta_first] = meta first
regions[meta_last] = meta last
; ------- Declare default theme features
features[] = logo
features[] = name
features[] = slogan
features[] = mission
features[] = node_user_picture
features[] = comment_user_picture
features[] = search
features[] = favicon
features[] = primary_links
features[] = secondary_links
; ------- Set the default settings to be used in theme-settings.php
; ------- Non-960gs general settings
settings[reset_css] = 1
settings[text_css] = 1
settings[regions_css] = 1
settings[defaults_css] = 1
settings[custom_css] = 1
settings[front_page_title_display] = title_slogan
settings[page_title_display_custom] = ''
settings[other_page_title_display] = ptitle_stitle
settings[other_page_title_display_custom] = ''
settings[configurable_separator] = ' | '
settings[omega_breadcrumb] = 'yes'
settings[omega_breadcrumb_separator] = ' / '
settings[omega_breadcrumb_home] = 1
settings[omega_breadcrumb_trailing] = 1
settings[omega_breadcrumb_title] = 1
settings[mission_statement_pages] = home
settings[sidebar_combine] = 1
settings[sidebar_contain_pages] = ''
; ------- / Non-960gs general settings
; ------- 960gs default region settings
; ------- default_container_width applies to regions like $help, $messages
settings[omega_default_container_width] = 24
; ------- Region settings for top zone (logo, menus)
settings[omega_branding_wrapper_width] = 24
settings[omega_header_logo_width] = 4
settings[omega_header_menu_width] = 12
; ------- Region settings for header regions
settings[omega_header_wrapper_width] = 24
settings[omega_header_nav_width] = 24
;settings[omega_header_last_width] = 8
; ------- Region settings for default breadcrumb and search box placement
settings[omega_internal_nav_wrapper_width] = 24
settings[omega_breadcrumb_slogan_width] = 10
settings[omega_search_width] = 6
; ------- Region settings for preface regions
;settings[txi_preface_wrapper_grids] = 24
;settings[omega_preface_first_width] = 12
;settings[omega_preface_first_prefix] = 0
;settings[omega_preface_first_suffix] = 0
;settings[omega_preface_middle_width] = 12
;settings[omega_preface_middle_prefix] = 0
;settings[omega_preface_middle_suffix] = 0
;settings[omega_preface_last_width] = 0
;settings[omega_preface_last_prefix] = 0
;settings[omega_preface_last_suffix] = 0
; ------- Region settings for content regions
settings[omega_content_layout] = first_content_last
settings[omega_content_container_width] = 24
settings[omega_sidebar_first_width] = 6
settings[omega_content_main_width] = 17
settings[omega_sidebar_last_width] = 0
; ------- Region settings for postscript regions
settings[omega_postscript_container_width] = 24
settings[omega_postscript_one_width] = 12
settings[omega_postscript_one_prefix] = 0
settings[omega_postscript_one_suffix] = 0
settings[omega_postscript_two_width] = 6
settings[omega_postscript_two_prefix] = 0
settings[omega_postscript_two_suffix] = 0
settings[omega_postscript_three_width] = 4
settings[omega_postscript_three_prefix] = 0
settings[omega_postscript_three_suffix] = 0
settings[omega_postscript_four_width] = 4
settings[omega_postscript_four_prefix] = 0
settings[omega_postscript_four_suffix] = 0
; ------- Region settings for footer regions
settings[omega_footer_container_width] = 24
settings[omega_footer_first_width] = 5
settings[omega_footer_last_width] = 19
; ------- / 960gs default region settings
; Information added by drupal.org packaging script on 2010-07-22
version = "6.x-1.0-beta11"
core = "6.x"
project = "omega"
datestamp = "1279809608"
It's probably because of this code in your theme-settings.php file:
// Get the default values from the .info file.
if (count($subtheme_defaults) > 0) {
// Allow a subtheme to override the default values.
$settings = array_merge($subtheme_defaults, $saved_settings);
}
else {
// Merge the saved variables and their default values.
$defaults = omega_theme_get_default_settings('omega');
$settings = array_merge($defaults, $saved_settings);
}
and the fact that you've saved your settings on the admin/build/themes/settings/omega page.
You'll probably have to delete the relevant settings from the variables table in your database in order for the settings in the .info file to take affect.
I did a little more research into this after posting the above and found the following issue, which offers a better fix for your problem: http://drupal.org/node/795180
Solved. The issue was that you have to reset the default theme values.
This can be accomplished by visiting configuring your own theme:
/admin/build/themes/settings/
Clear the database settings for your theme by clicking "Reset to Defaults"
Thanks #oadaeh !

Resources