How to differentiate the homepage structure from the category page structure in WordPress template? - content-management-system

I am very news in WordPress world and I am finding some difficulties with creation of a personal template.
I want implement a blog like this one (that is do using WordPress): http://viralpatel.net/blogs/
My blog have to be simplest and there must be only two coluns: one for the last posts and one for the more visited post
So I am started from an existing template (named Coogee) and I have divided the content area (the index.php file) into two columns: the first one that show the new posts and the second one that show the most read posts.
I have implement this features with some lines of code that I have put in my columns as show here:
http://bacsoftwareconsulting.com/blog/index.php/wordpress-cat/how-to-display-most-viewed-posts-in-wordpress-without-a-plugin/
Ok, now the homepage look good for my intents but I am having some problem in the categories page.
For example if you click on the "generic" link on Categorie menù in the side bare you obtain this page: http://scorejava.com/wordpress351/?cat=2
In teory this page have to show ONLY the articles that have "generic" as setted category but this is not true, infact in the left column are correctly showed the articles having "generic" category setted but in the right column still remain the last 5 posted articles...
And now I have a question...seems that WordPress use this index.php file as template of the content area of all page (except the one that displays a single article that uses **single.php file)
This is not good for me because I want that a category page show only one big column with the last articles of the current category, as here: http://viralpatel.net/blogs/category/spring/spring3-mvc-framework/
As you can see in this blog there is more columns in the homepage but only one column for the category page
I would know if:
**Exist a way to define an other structure (different from the index.php file used for the homepage articles content) for the catecories page?
If I can't use an other structure for the categories page and consequently I have to use the same index.php file also per the categories content page....there is a way to show the second column only if the visitor is in the homepage and don't show it if he is in a category page (do not show it if the visitor is in a pge like: http://scorejava.com/wordpress351/?cat=2
Or do you have some other solutions?
Tnx
Andrea

If wordpress code cannot find a category.php then it will use the index.php file.
index.php is like the fallback file.
The hierarchy structure for the categories go like
1> category-slug.php (Note: available with Version 2.9)
2> category-ID.php
3> category.php
4> archive.php
5> index.php
That is, if you do not have a category-slug.php (lets say category-news.php), WordPress will check for a category-ID.php (like category-6.php), and so on.
So i would suggest you create a category-slug.php file (where slug will be your category's slug).
for more info check out this link.
http://codex.wordpress.org/Category_Templates

Related

Blog-like single element pages with TYPO3 / TemplaVoila

I have a blog-like part of an page using TYPO3 / TemplaVoila. There are articles that should show up summarized on a single page, but have their own pages / URLs each one too.
However, having the editors add a page AND a flexible content element for each entry is complicated.
So is it possible by some typoscript to have a page, showing a single content element from some other page, sporting a proper URL without having to setup an extra page for each element?
What you want is doable without TV and with other records than tt_content.
e.g.: ext:news does it: the content are news records, which are shown with plugins in list- and detail-mode.
Of course you can reinvent the complete logic of such an extension so you can do it with tt_content records, which could be stored in the usual way scattered on multiple pages.
But the logic is clearer if there only is one page (or very few pages which represent some categorization) where special records are stored.
Plugins would be configured to show only selected records (from one category, which are marked top, which are current, ...) and you have one page (one for all and not for each news one) where the records are shown in detail.
Also each has it's own URL, either with URL-parameter (by default) or you configure realurl (or similar) to build a "real url" from news title (and uid).

Generate json feed from ext:news

TYPO3 7.6.16 ext:news 5.3.2
We're looking to create a json stream of news stories that have been created in the CMS so that we can consume the feed in other applications.  For each element in the feed we're looking include some simple properties such as the news story name, when it was published and a link to the news story, so that we can direct someone back to the relevant page on the Website.  
We've been able to return a list of news stories by querying the tx_news_domain_model_news table.  From this table we've been able to query all the information that we need from the story, but we're having trouble building a link to the story.
The links that the news plugin is building for each story at the moment takes the form:
/story/tx_news_pi1%5Bnews%5D=18&tx_news_pi1%5Bcontroller%5D=News&tx_news_pi1%5Baction%5D=detail&cHash=a6e542381e508c0501a09383cedc4d70.
So the id field of the news story field is included as a parameter.  We've tried making links by adjusting this parameter for the various Ids of different news stories, but each link allways returns the same news item.  So we are assuming that the hash value for each nwes story has to be calculated for each item to find the correct story.
Our question is.  Is it possible to build a unique URL for each story based on the information in the tx_news_domain_model_news table or is there a better way to create a JSON feed for each news story which includes the link to the original article.
You could define a special page rendering. either a new page or a new pagetype of an existing page.
You use a page object and instead of the usual include of a template the whole content is generated by a CONTENT object. With this you select all news records and define a renderobject where you can use FLUIDTEMPLATE or build up the rendering in typoscript.
In this way you can generate 'normal' URLs, which also might be niced by realurl.
If you want to output other formats than HTML you propably need to escape string-delimiters in your texts and strings.
Fluid templates may be a little bit complex if you have a format where whitespace is important. In typoscript whitespace can be handled with stdWrap.noTrimWrap

tx_news direct link to news entry

it is possible to have a direct path to a special news entry?
example:
my link is: http://www.domain.de/start/topnewsdetail/news/really-long-name-of-news-entry.html
and it would be nice to have
http://www.domain.de/newsEntry.html.
Can someone give a hint?
it is a little bit complicated if you want a general automatic solution.
you can do it by hand if you insert pages of type 'external url' where you insert the long path as external url.
with realurl you have problems as realurl at least will use one path segment for the page with the detail view before the last segment which is for identifying the news record. AFAIK coolurl can ommit the path segemnt for the page.
on the other hand: make sure the news identification (title, subtitle?) is unique and does not collide with pathes for normal pages.
at last you can use .htaccess rewrites, but that needs to differentiate between short urls for news and short urls for top-level pages. So those urls will show the page, those urls are not generated inside of TYPO3 and so nowhere used (except manual)
this EXT. adds a custom link to records like system category or news:
https://typo3.org/extensions/repository/view/recordlink
It'S deployed for TYPO3 6.2 but perhabs it'S helpful to create an own EXT.?

Linking content from one page to another in Confluence

We have bunch of Confluence pages for each team to note down the leaves. Each such page consists of a table with team, team member name, month, week ..etc.
Now we want to have a consolidate page which shows information about all the teams in a single page. Can we create a consolidated page which uses the content in all other pages?
I read about macros but couldn't understand how they can be used. Is it possible to use content from one page in another page dynamically?
Yes you can by using the "Excerpt" macro (to mark one section in a page as "insertable" and use this in another page). If you need to have multiple sections in one page to reuse in other pages, there is also a "Multi Excerpt" macro.
So, for example, if you have a page with a few lines of text, you can basically insert the excerpt macro and paste all content into it that you want to reuse on other pages:
(source: imagestack.net)
(in this case I want to reuse "line 2")
In another page, you can reference this marked content by inserting the "Excerpt Include" macro and specifying the page you want to take the marked content from:
(source: imagestack.net)
The result in this case is

How to show facebook comments box multiple times on a page?

I have a page for a bakery site, and on the page, there will be a list of cakes. There will be a picture of the cake, followed by a comments box, to let people comment on that specific cake. Each cake will need to have its own set of comments, separate from each other.
But unless I'm mistaken, facebook comment plugin is linked to a page's url, and can't be shown multiple times?
Is there any way to show it multiple times per page, and to link it individually to each cake, so the comments don't mix up?
But unless I'm mistaken, facebook comment plugin is linked to a page's
url, and can't be shown multiple times?
It can be shown.Though it is linked with your site url,you always have the privilage of appending custom string after the ternerary operator in your URL.
Is there any way to show it multiple times per page, and to link it
individually to each cake, so the comments don't mix up?
The trick here is to make a url unique.
This can be done in various ways:
1)www.something.com#commentbox1
2)www.something.com?section=commentbox1
I am using this on my current website where there are more than 10 comment boxes:http://www.arrowlife.com/
In addition to unique anchor tags per product, you may also add the product ID in a query string such as www.yoursite.com?productID=44
In my case I was dynamically creating a div showing the product detail. It was also necessary to force the Facebook script to show the comment section using the FP.XFBML.parse command